The grammar indicates that the module name is an identifier, and identifiers can't start with digits (you can't have a variable name that starts with a '1' either).
This is probably quite fundamental (I guess the lexer will implement it) so suspect it is impossible to change. That means it is a bug, not a feature (and it's quite a reasonable restriction, since it reduces ambiguity). See http://docs.python.org/3.0/reference/simple_stmts.html#import http://docs.python.org/3.0/reference/lexical_analysis.html#grammar-token-identifier Andrew simon.wo...@gmail.com wrote: > Hello, all. > > I don't suppose anyone has any idea why it seems to be impossible to > import any file which starts with a number? You get a syntax error, > whether the file exists or not. > > Try it yourself: > >>>> import foo > ImportError: No module named foo > >>>> import 1foo > File "<stdin>", line 1 > import 1foo > ^ > SyntaxError: invalid syntax > > Is this just me, or has anyone else run into it? Is it a known bug? > (If so, I can't find it on a bug tracker or in any Google searches). > > It's a bit annoying, as I have an enforced naming scheme. Any way > round it? > > Thanks in advance! > > Simon > -- > http://mail.python.org/mailman/listinfo/python-list > > -- http://mail.python.org/mailman/listinfo/python-list