[Pythonmac-SIG] weird syntax error (bug?): self.from
Ben Coburn
Ben Coburn <btcoburn@oberlin.edu>
Thu, 21 Sep 2000 05:12:21 -0400 (EDT)
On Thu, 21 Sep 2000, Jack Jansen wrote:
>
> > class foo:
> > def __init__(self):
> > self.from = 'fubar'
> >
> > It generates a syntax error somewhere within self.from.
>
> Yep, from is a reserved word ("from foo import *") so you can't use it as an
> identifier.
>
Hummm. What I have been wondering is that with Python designed to be
easy to code/read... why doesn't it us the Java syntax "import foo.*".
This would be much more consistent with "import foo" than "from foo
import *". I guess that it is this way to discurage people from using
"from foo import *". In that case it is a subtler hint tword good
programming style, than Java's simply outlawing pointers for example.
Regards, Ben Coburn
-----------------------------------------------------------------------
Ben Coburn "Black holes are where God divided by zero." -Anon.
btcoburn@oberlin.edu Biology (CS & Chem)
http://www.oberlin.edu/~bcoburn/ Oberlin College
-----------------------------------------------------------------------