metaperl <[EMAIL PROTECTED]> wrote:

> Diez B. Roggisch wrote:
> > metaperl schrieb:
> > >   -->  python -i
> > >>>> class = "algebra"
> > >   File "<stdin>", line 1
> > >     class = "algebra"
> > >           ^
> > > SyntaxError: invalid syntax
> > >
> > >
> > > Why isn' t the parser smart enough to see that class followed by an
> 
> >  the few reserved words won't matter usually.
> 
> woe be unto the ORMs who try to map database columns to Python
> attributes.

I'm gonna skip my usual anti-ORM rant, because there ARE valid case for
"mapping external names to Python identifiers" -- e.g., remote protocols
such as XML-RPC, automatic constructers of FF interfaces, etc.  Such
code generators -- targeting ANY language currently alive -- obviously
have to possess some minimal knowledge of the target language's syntax,
and the obvious solution is to systematically transform identifiers
which would otherwise be keywords.  The one most popular convention is
to append an underscore -- so that 'pass' becomes 'pass_', and so on.


Alex
 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to