Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread simon . woolf
> So in a sorted list of files, some of the project 1.2 files will > appear under 1-2 and others miles away under 1_2 ? And even if > the submitter is not so dopey, the submittee has two different > possibilities when looking for project 1.2's files? Brilliant! And > this is an educational

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread John Machin
On Mar 24, 9:12 am, simon.wo...@gmail.com wrote: > Many thanks to all for explanations.  I'm going to take everyone's > advice and ignore the naming scheme (especially as, on rereading, the > naming scheme is apparently only mandatory if you're using C or Maple, > for some reason). > > Thanks again

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread simon . woolf
Many thanks to all for explanations. I'm going to take everyone's advice and ignore the naming scheme (especially as, on rereading, the naming scheme is apparently only mandatory if you're using C or Maple, for some reason). Thanks again. Simon (For those interested: > Do you mean that some au

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread John Machin
On Mar 24, 4:56 am, simon.wo...@gmail.com wrote: > It's a bit annoying, as I have an enforced naming scheme. Do you mean that some authority other than yourself is seriously insisting that the names of source files *must* start with one or more digits? What is the rationale for such a scheme? --

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread andrew cooke
andrew cooke wrote: ffs. feature, not bug. sorry. > 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). -- http://mai

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread MRAB
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 Fil

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread andrew cooke
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

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread Gabriel Genellina
En Mon, 23 Mar 2009 14:56:21 -0300, escribió: 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. You don't import a file, you import a module. And a module name is an ident

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread Miles
On Mon, Mar 23, 2009 at 1:56 PM, 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. Identifiers can't start with a number. http://docs.python.org/r

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread simon . woolf
Forgot to mention: I'm on Python 2.5.2, on Ubuntu 8.10. Simon -- http://mail.python.org/mailman/listinfo/python-list

Syntax error when importing a file which starts with a number

2009-03-23 Thread simon . woolf
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 "", line 1 import 1fo