Python Gotcha's?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Apr 15 15:59:36 EDT 2012


On Sun, 15 Apr 2012 15:30:39 +0000, Curt wrote:

> On 2012-04-15, Steven D'Aprano <steve+comp.lang.python at pearwood.info>
> wrote:
>>> 
>>> We disagree. Not surprising in a "gotcha's" thread.
>>
>> Yes, but I have reasons for disagreeing, which you trimmed out of your
>> response. If you have reasons for thinking that a separate file
>> extension for Python 3 is a good idea, you are keeping it to yourself.
> 
> Didn't you trim his reasons, speaking of trimming (maybe they were
> nonsensical, or poor, but it seems they were there before you made them
> disappear)?

No, you remember wrongly. Bryan states that the use of the same file 
extension is a gotcha, but that's it.

    [quote]
    Python 3(K) likes to use the same '.py' file extension as 
    its incompatible predecessors

http://mail.python.org/pipermail/python-list/2012-April/1290909.html


Python 3 uses the same file extension as its incompatible predecessors 
for the same reason that Python 2.6 uses the same file extension as its 
incompatible predecessors, and 2.5 as as its incompatible predecessors, 
and so on all the way back.

"Incompatible" is not a binary state, it is a matter of degree. Python 
3.1 is less compatible to Python 2.7 than 2.7 is to 2.6, but the vast 
bulk of the language is still identical and code supporting everything 
from 2.5 to 3.2 in one code base is possible.

In my experience, it is MUCH easier to write code targeting versions 2.5 
through 3.2 than it is to target 2.4 and 2.5 only, on account of how 
impoverished 2.4 is compared to 2.5. (I once started a project to 
backport useful 2.5 features to 2.4. I gave up because it was just too 
painful.)


-- 
Steven



More information about the Python-list mailing list