Module names beginning w/ a digit

Jeremy Yallop jeremy at jdyallop.freeserve.co.uk
Thu Nov 7 19:04:33 EST 2002


* John E. Barham
| Why can't Python module names start a digit?

Module names are usually subject to the same rules as other
identifiers.  When you import a module in the "normal" way, its name
is bound in the current global dictionary.

|>>> import 9P
|   File "<stdin>", line 1
|     import 9P
|            ^
| SyntaxError: invalid syntax

>>> nineP = __import__('9P')

will work but it's better to use a different name if you can.

Jeremy.



More information about the Python-list mailing list