Bugs in CPython 3.1.1 [wave.py]

Alf P. Steinbach alfps at start.no
Tue Jan 12 23:42:28 CET 2010


* André:
> On Jan 12, 9:33 am, "Alf P. Steinbach" <al... at start.no> wrote:
> 
>> Well, this is for my Python (actually, beginning programmer) writings, at
>>
>>    http://tinyurl.com/programmingbookP3
>>
> 
> Thanks for writing this book.  I just had a quick look at the
> beginning of it where you write:
> ===
> 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 hopeless to try
> to create programs that work the same – or even just work – with both
> variants.
> ===
> Notwithstanding your experience (finding a bug in wave.py), this
> statement is false.  There are plenty of non-trivial applications that
> have been ported so that they work "as is" with both Python 2.x and
> Python 3.x.

I'm sorry but your conclusion does not follow from the fact that you point out.

It is hopeless, especially for a newbie, to create correct Python 2.x+3.x 
compatible code, except totally trivial stuff of course.

This due most of all to the language differences, but also to the fact that 
there are PLENTY of libraries that haven't yet been ported, like PIL...


>   If you do a google search, I am sure that you can find
> many examples proving this point.  For example, you may want to read:
> http://mail.mems-exchange.org/durusmail/qp/441/ .... or try out
> Crunchy  (http://code.google.com/p/crunchy).   It may be required to
> isolate some small parts and do conditional imports ... but this is
> fairly straightforward to do if one writes a new application.

If it were straightforward then it wouldn't be darned difficult, would it?`:-)

The problem isn't just writing code that runs with both Python languages.

The problem is writing code that is correct with both languages, which is 
hopeless when e.g. integer division changes underfoot, like "/" meaning two 
different things depending on the language, print syntax changing, so forth.


Cheers & hth.,

- Alf



More information about the Python-list mailing list