Those two controversial 2nd & 3rd paragraphs of my ch 1
fetchinson at googlemail.com
Wed Jan 13 16:23:08 CET 2010
>> As of this writing two main variants of the Python language are in use,
>> namely Python 2.x and Python 3.x (versions 3.0 and greater). Mostly
>> they’re the same but the effect of e.g. the / division operator changed in
>> 3.0, so in practice it’s very hard to create programs that work the same
>> – or even just work – with both variants. The examples and discussion in
>> this book assume Python version 3.1.1 or later.
> It may be hard to support Python 2 and 3 with the same script, but the
> division operator is not a good example to support that statement because
> you can get the 3.x behaviour in 2.x with a simple
> from __future__ import division
> at the top of the module.
I was about to write the same!
Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57)
[GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import division
Also, I would replace
"in practice it’s very hard to create programs"
"in practice it’s very hard to create complex programs"
because for small programs it's very possible to write code that will
work with both python 2 and 3. The question is of course what program
is simple/small and what program is large/complex, but without
qualifications your sentence is misleading, I think.
Psss, psss, put it down! - http://www.cafepress.com/putitdown
More information about the Python-list