Atoms, Identifiers, and Primaries

Bruce McGoveran bruce.mcgoveran at gmail.com
Tue Apr 16 22:57:25 EDT 2013


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:

1.  Section 5.2.1 indicates that an identifier occurring as an atom is a name.  However, Section 2.3 indicates that identifiers are names.  My question:  can an identifier be anything other than a name?

2.  Section 5.3 defines primaries as the most tightly bound operations of Python.  What does this mean?  In particular, if an atom is a primary, what operation is the atom performing that leads to the label "most tightly bound"?  To put it a different way, I think of atoms as things (i.e. identifiers).  The documentation makes me think atoms actually do something, as opposed to being things (I think I have in my mind the difference between a noun and a verb as I write this).  Perhaps the doing in this case (or binding, if you like) is linking (binding) the identifier to the underlying object?  I think it might help if I had a better working notion of what a primary is.

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?

These are, I know, long-winded questions.  I appreciate in advance any thoughts the group can offer.

The relevant documentation link is:  http://docs.python.org/2/reference/expressions.html#expressions

Thanks,
Bruce



More information about the Python-list mailing list