On 04/16/2013 10:57 PM, Bruce McGoveran wrote:
These are terms that appear in section 5 (Expressions) of the Python online 
documentation.  I'm having some trouble understanding what, precisely, these 
terms mean.  I'd appreciate the forum's thoughts on these questions:


3.  Section 5.3.1 offers this definition of an attributeref:
     attributeref ::= primary "." identifier

Now, I was at first a little concerned to see the non-terminal primary on the 
right hand side of the definition, since primary is defined to include 
attributeref in section 5.3 (so this struck me as circular).  Am I correct in 
thinking attributeref is defined this way to allow for situations in which the 
primary, whether an atom, attributeref (example:  an object on which a method 
is called that returns another object), subscription, slicing, or call, returns 
an object with property identifier?


It is circular. Nothing wrong with that. It means that not only can you use
    a.b

but also
    a.b.c

and
    a.b.c.d.e.f.g

without any explicit limit. if a non-circular definition were to be attempted, you might need a few dozen rules, just to cover what someone *might* happen to use in an expression. Of course normally, one doesn't go much beyond a.b.c in a single expression.


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

Reply via email to