Carl Banks wrote: > metaperl wrote: > > --> 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 > > identifier is used for class definition but class followed by equals is > > a simple assignment? > > Hmm. Someone called "metaPERL" is asking why Python doesn't have a > more complicated grammar. Why does this not surprise me? :)
Yeah. But elimination of all keywords and replacement by punctuation is clearly an alternative. One might just start with: @class X(object): @def __init__(self): @print "an X" and move on to: @% X(object): @_ _init__(self): >> "an X" That's all still LL(1) parsable. -- http://mail.python.org/mailman/listinfo/python-list