[Tutor] Hello, and a newbie question

Steven D'Aprano steve at pearwood.info
Wed Apr 17 02:11:03 CEST 2013


On 17/04/13 01:58, Andy McKenzie wrote:

> 1) Python 2.7 or 3.x?  I know I'm going to want to do some work with NLTK
> (which appears to only have an alpha version out for Python 3), but I've
> just gone through the hassle of dealing with an upgrade from PHP 4 to 5.3,
> and I'd rather not start learning something that's already obsolete.  Any
> words of advice?

Python 3.3 is awesome and much cleaner and better than 2.7, and 2.7 is
pretty damn good! So if you have a choice, pick 3.3. It's the future of
Python, 2.7 is the past.

But, 2.7 is still good, and if you need NLTK *right now* you might not have
a choice. (Unless you like being a guinea pig working with an alpha version.)

Also, the *incompatibilities* between 2.7 and 3.3 are fairly small. The
biggest difference from a beginner's perspective is that print is no longer
a statement, it is a function, so instead of writing this:

print "Hello world!"

you have to write this:

print("Hello world!")

That doesn't seem too onerous, does it? If you can cope with a few differences
of that complexity, why not learn both?


> 2) Best practices.  I have the WROX Press Beginning Python book, which
> targets Python 2.  Clearly that's of only limited value if I'm going to go
> with Python 3, but it looks like it's at least going to be a good overview.
>   But some of the stuff they do seems to be fairly personalized, rather than
> trying to follow standards.  Should I just start out with the tutorial from
> docs.python.org?  I would assume that that would start putting me in the
> right habits from the beginning... is that accurate, or is there a better
> way to go?

If there's a Python 3 version of "Learning Python", from O'Reilly Books (sorry
I forget the authors), give it a go. The first edition, at least, is an awesome
book although you will want a more recent version since the first edition
deals with Python 1.5, which truly is ancient history!

I haven't done the official Python tutorial, but from what I've seen of it,
it's pretty good.



-- 
Steven


More information about the Tutor mailing list