Bugs in CPython 3.1.1 [wave.py]

Alf P. Steinbach alfps at start.no
Wed Jan 13 06:39:53 CET 2010


* Steven D'Aprano:
> On Tue, 12 Jan 2010 23:42:28 +0100, Alf P. Steinbach wrote:
> 
>> * 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.
> 
> So you allege, but André points out that there are existing, non-trivial 
> applications that work unmodified under both Python 2.x and 3.x. For 
> example, CherryPy:
> 
> http://www.cherrypy.org/wiki/WhatsNewIn32
> 
> You're welcome to your own opinion, of course, but not your own reality, 
> and the reality is that it is NOT "hopeless" to write correct Python code 
> that operates under both 2.6 and 3.x. It's not hopeless because it's been 
> done. You might even be able to target versions older than 2.6 if you 
> really work at it, as CherryPy does.
> 
> Continuing to assert something which is demonstrably untrue simply means 
> you lose credibility among those who are familiar with Python.

You're confusing the existence of special cases where something has been done, 
at great cost, with a belief that it's practical to do so in general.

It's not exactly like confusing existential versus universal quantification, but 
it's close.

Thus, your demonstration amounts to "it's not hopeless to walk on the moon: 
look, Louis Armstrong did!"  --  uh, Neil, whatever.

He he. :-)

No, sorry, I apologize, I'm unkind now.

*Slapping my keyboard hand*

But it gets to me how often people here sort of rise to the defense of Python as 
if it needed defending.

It's a great language, it needs no defense, especially not of the kind where one 
tries to suppress facts and silence critique. Indeed, what it needs seems to 
instead be the opposite, a good dose of reality and openness. The reality is 
that the divide between 2.x and 3.x is still very wide, and utterly hopeless for 
a newbie to cross (professionals can do so at great cost).

Over in C++-land it's opposite.

Even the most enhusiastic C++ programmers almost revel in finding faults with 
the language and its standard library, tools etc. And I think that's because 
there's no inferiority complex, or very little of it. So, repeating: Python is a 
great language, it really is, but There Are Issues, of course there are issues, 
and the best way or at least a good way to go about it is adopt that (great, but 
of course has issues) as one's basic view, and be critical.


>> 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...
> 
> Right, and if your application requires PIL, then it is impossible, but 
> for the countless applications that *don't* require PIL, it makes no 
> difference at all.

They require other stuff. :-)

Plus, the basic language issues are at the core of all these problems.

But see above.


> [...]
>> 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.
> 
> from __future__ import division
> from __future__ import print_function
> from future_builtins import hex, map  # or whatever
> 
> 
> Not even close to hopeless.

You might consider that I'm very much aware of the above facilities.

Then be a little critical and think about, what problems could it be that, in 
spite of that to you apparent simplicity, hinders the widespread adoption of 
Python 3.x?

Repeating, Python is a great language. I'm not about dissing the language. I 
think it's rather silly when people believe that, and it's rather sad when they 
then employ negative sum thinking: think positive!

Cheers & hth.,

- Alf



More information about the Python-list mailing list