MRAB wrote:
> One thing that puzzles me is that the PEP shows that "Python -U" has a
> different magic number from "Python", but I can't find any reference to
> "-U" (the options appear to be case-sensitive, so presumably it's not
> the same as "-u").

We deliberate don't document -U because its typical effect is "break the
world" - it makes all strings unicode in 2.x.

You really don't want a -U pyc in a non -U interpreter and vice-versa,
hence the difference magic numbers.

This is also the reason why using the version number in the filename
isn't adequate - the magic number can change due to more than just the
Python version changing. Also, if we don't change the bytecode for a
given release, then multiple versions can use the same magic number.

Hiding these away in an appropriately named subfolder is the nicest way
to handle it without cluttering the source code directory.


Nick Coghlan   |   |   Brisbane, Australia
Python-Dev mailing list

Reply via email to