Python Gotcha's?

Bryan bryanjugglercryptographer at yahoo.com
Sun Apr 15 16:01:54 EDT 2012


Steven wrote:
> 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.

On Windows the file extension determines what executable opens the
file. Running both Python 2 and Python 3 on Windows is painful where
it doesn't need to be. I'd like to encourage my users to check out
Python 3, but installing it on Windows will take over the '.py'
extension and break stuff that currently works.

Incidentally, I'm not actually advocating for '.py3'. I'm advocating
for '.py4'.

> 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.

You could think of it as the same file extension in a different
dialect, but really the works/broken distinction is more important
than language/dialect.

> 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?

The file extension default should work with the the recommended
transition method, which is not dual-major-version code. Admittedly,
support for such code has improved.

> 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.

Python's management of backwards compatibility for minor version has
worked pretty well, at least for me. Major version simply do not
attempt backward compatibility.

Your experience seems to be quite different from mine. I don't recall
a minor version upgrade ever giving me significant trouble with my own
code. The issue has been the external libraries upon which I depend,
and they've tended to catch up quickly, unlike what we're seeing with
Python 3.

> 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.

Because it would allow Windows user to play with Python 3 alongside
Python 2, while waiting for external libraries to catch up. Of course
they can, as I am, but the gotchas are really annoying. With minor
versions its not a big deal if most users simply wait to do an
upgrade.

-Bryan



More information about the Python-list mailing list