[Python-Dev] Python Grammar Ambiguity

Christos Georgiou tzot at mediconsa.com
Fri Apr 28 09:33:34 CEST 2006


"Michael Foord" <fuzzyman at voidspace.org.uk> wrote in message 
news:444CD3DB.7050704 at voidspace.org.uk...
<snip>
> It worries me that there might be a valid expression allowed here that I
> haven't thought of. My current rules allow anything that looks like
> ``(a, [b, c, (d, e)], f)`` - any  nested identifier list. Would anything
> else be allowed ?

Anything that goes in the left hand side of an assignment:

# example 1
>>> a=[1,2]
>>> for a[0] in xrange(10): pass

# example 2
>>> class A(object): pass

>>> a=A()
>>> for a.x in xrange(10): pass




More information about the Python-Dev mailing list