On Tue, Apr 16, 2013 at 8:57 PM, Bruce McGoveran
<bruce.mcgove...@gmail.com> 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:
>
> 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?

Yes.  For example:

from a import b

Here "a" is an identifier but not a name, as it does not carry
object-binding semantics.

> 2.  Section 5.3 defines primaries as the most tightly bound operations of 
> Python.  What does this mean?

"Tightly bound" here refers to operator precedence.  For example, we
say that the multiplication operator binds more tightly [to the
surrounding operands] than the arithmetic operator, because the
multiplication takes precedence.  This section defines that the most
tightly bound operations in Python are attribute references,
subscriptions, slices and calls; these always take precedence over
other neighboring operations.

> In particular, if an atom is a primary, what operation is the atom performing 
> that leads to the label "most tightly bound"?

An atom doesn't perform an operation.  The grammar defines that a
primary can be just an atom, so that anywhere in the grammar that
expects a primary, a simple atom with no primary operation performed
on it can equally be used.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to