Compiler directives in the source
Andrew Dalke
dalke at dalkescientific.com
Thu Feb 6 15:24:06 EST 2003
Skip Montanaro <skip at pobox.com>:
> Yes, but code containing such a cookie wouldn't run on older versions of
> Python. Sticking the encoding information in a magic comment is a hack,
> everyone knows that,
There's also the deprecation route. Say that for new versions of
Python the encoding is specified by the syntax
%encoding -blah-
but for backwards compatibility the form
#%encoding -blah-
is also allowed, in in Python 2.5 it will generate a DeprecationWarning
and in 2.6 a DeprecationError.
Me, I don't care. I've been doing all this for entirely too long,
so I get the shivers when I see non-ASCII anywhere, ... execepting
a bit of Latin-1 in comments. So any solution is better, and it's
not something where I care that deeply about the elegance.
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list