Python Gotcha's?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Apr 15 11:17:19 EDT 2012
On Sun, 15 Apr 2012 02:23:27 -0700, Bryan wrote:
> Steven D'Aprano wrote:
>> Bryan wrote:
>> > Python 3(K) likes to use the same '.py' file extension as its
>> > incompatible predecessors,
>>
>> And so it should.
>
> 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.
Python and C are different languages. Python 2 and Python 3 are not, they
are the same language with only a few minor dialect differences.
There is a practical argument against separate file extensions: which
extension do you use for code intended to run with both Python 2 and 3?
We didn't need a new file extension for the transition between Python 2.5
(string exceptions are legal) and Python 2.6 (string exceptions cause a
SyntaxError exception). Nor did we need a new file extension for the
transition between Python 2.1 (nested functions behaved one way) and
Python 2.2 (nested functions behaved a different way). We certainly
didn't have a new file extension when the bastion or gopher modules were
removed from the standard library, backwards-incompatible changes if I've
ever seen one.
If there's a good argument in favour of separate file extensions for
Python 2 and Python 3 (one which doesn't also apply to, say, Python 2.5
and 2.6, or 3.1 and 3.2) I'm afraid I don't know it.
--
Steven
More information about the Python-list
mailing list