PDA

View Full Version : help getting started with Python



Ascenti0n
March 7th, 2009, 06:26 PM
Hi all,

I currently develop web apps using PHP/HTML/MySQL/Javascript/CSS and thought it would be great to learn a language the could extend out of the web.

After some searching on Ubuntu forums and some Googling, I found out more about the open source Python and the fact that it can work on web servers as well as the desktop, excellent.

But I understand a v3 of Python has been released. Can someone please advise which version I should learn on?

Ubuntu has v2.5 I think, my web host has 2.3. The obvious would be to learn v2.3 BUT, I am not in a rush to learn EVERYTHING, it's purely for fun ATM, and I'm not sure if take up is as with PHP ie Slooooooooow

Any advice?

μ .
March 7th, 2009, 06:46 PM
Since you aren't in any rush, you're probably better off with python 3.0.1.

Ascenti0n
March 7th, 2009, 06:57 PM
How can I run Python 3.0? in Ubuntu? and how fast does the rest of the world takeup on new versions? quicker than PHP?

imdano
March 7th, 2009, 07:07 PM
I wouldn't try to use Python 3 yet. It breaks backward compatibility with 2.x code, which makes it extremely disruptive to upgrade to it. The 2.x line is going to be the norm in Linux distros for a while (i.e. several years). I'd stick with the version installed by default in Ubuntu for now.

pfdevil
March 7th, 2009, 07:10 PM
If your into the whole web development world then give Ruby a try, and from there use Ruby on Rails.

Can+~
March 7th, 2009, 07:23 PM
First things first.

a) Learn python in depth
b) Then check out for things like django, cherrypy or whatever

And beginners won't notice the difference between python 2.5.2 and python 2.6/3, the most noticeable thing is that print changed from statement to function.

So start with 2.5.2 (the one that ubuntu comes with).

μ .
March 7th, 2009, 08:16 PM
It breaks backward compatibility with 2.x code, which makes it extremely disruptive to upgrade to it.

Well, he doesn't seem to have any code at the moment so, that seems more like a reason to use 3.

jimi_hendrix
March 7th, 2009, 08:19 PM
i would advise 2.x, because 3.0 is slower and a little worse...or thats what the python masters in ##python on irc.freenode.net told me

jimi_hendrix
March 7th, 2009, 08:29 PM
If your into the whole web development world then give Ruby a try, and from there use Ruby on Rails.

perl is also a big CGI language that can be used alone for other things

μ .
March 7th, 2009, 08:38 PM
i would advise 2.x, because 3.0 is slower and a little worse...or thats what the python masters in ##python on irc.freenode.net told me

That's reasonable.

Can+~
March 7th, 2009, 08:42 PM
Well, he doesn't seem to have any code at the moment so, that seems more like a reason to use 3.

I also jumped into Python 3, but for my disappointment, there still libraries needing to be ported, GTK (http://bugzilla.gnome.org/show_bug.cgi?id=566641) comes to mind.

Ascenti0n
March 7th, 2009, 09:41 PM
so much conflicting advice....

as long as there isn't too many changes from 2.x to 3, I think I'll stick to the advice of 2.x, especially if uptake is as slow as PHP. Besides, if I really get into I can only go as far, version wide, as my web host will allow.

imdano
March 7th, 2009, 11:13 PM
so much conflicting advice....The topic of the official python irc channel says:

Topic for #python is: NO LOL | It's too early to use python 3.x (seriously) | Pasting > 3 lines? Use http://paste.pocoo.org/ | Tutorial: http://docs.python.org/tut/ | FAQ: http://effbot.org/pyfaq/ | New Programmer? Read http://tinyurl.com/6pgof8 | #python.web #wsgi #python-fr #python.de #python-es #python.tw #python.pl #python-br #python-jp | Python 2.6.1 released! http://tinyurl.com/6ou9tl

μ .
March 8th, 2009, 12:43 AM
The topic of the official python irc channel says:

Hmm, nvm then. :) This makes me wonder why they released it like that.

Can+~
March 8th, 2009, 12:56 AM
Hmm, nvm then. :) This makes me wonder why they released it like that.

python3 is practically complete, it has all it's own libraries, adds some libraries like multiprocessing (http://docs.python.org/3.0/library/index.html), etc. But gtk, cairo, pygl, pygame, all are 3rd party libraries that need to be updated yet.

matyasfalvi
March 8th, 2009, 06:02 PM
Hello People!

Recently I also just started to work with python and I have a few very basic questions that I would like to have answered.

1. some how my help function doesn't work, as far as I understand there is a help() function, which you can use interactively from command line, right? E.g. help(file) tells you all about the object file. So this is what happens:



george@george-laptop:~$ python help()
bash: syntax error near unexpected token `('
george@george-laptop:~$


2. how can I check which version of python I am running?

Cheers!

soapytheclown
March 8th, 2009, 06:35 PM
try python to get you into the interactive prompt first then help()

so :

python
[return]
help()

Can+~
March 8th, 2009, 06:40 PM
canxp@asgard:~$ python
Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> help()

Welcome to Python 2.5! This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://www.python.org/doc/tut/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help>

matyasfalvi
May 18th, 2009, 12:06 PM
soapytheclown, Can+~ thanx a lot guys!