UserLinux chooses Python as "interpretive language" of choice

Terry Reedy tjreedy at udel.edu
Tue Dec 23 11:32:48 EST 2003


"Francis Avila" <francisgavila at yahoo.com> wrote in
message news:vug18vkmjpiice at corp.supernews.com...
The word 'name' is used in multiple senses in
Python, which seems to sometimes get confused.

>  But a name is part of an object.

Modules, classes, and functions have a __name__
attribute for the purpose of forming a string
represention.  Other builtins do not.  This is the
secondary use of 'name'.  Otherwise, 'names', in
the primary sense as code token, are *not* parts
of an object.

>  Namespaces arise from objects possessing names.

Since objects only 'possess' token names by virtue
of being associated with them in namespaces, this
does not seem a useful viewpoint.

>  This is why I can't see how names can be
objects in Python:

Token names are grammatical code units, like
expressions and statements (which are also not
objects *in* Python).  We use them to direct
computation with objects.  The interpreter may
implement token names (and namespaces) in any way
consistent with the defined semantics of the
expression and statement they occur in.  CPython,
in particular, sometimes converts them to Python
strings and sometimes to C ints.

>they are incapable of existing independent of an
object.

They exist in code prior to the creation of ojects
due to running of the code.

John Roth" <newsgroups at jhrothjr.com> wrote in
message

> Technically, since names are simply keys in
dictionaries,

This is only true of attribute names, the third
use of 'name'.  Definition names start as code
token names and become values of a __name__
attribute, not a key.  Code token names otherwise
become whatever the interpreter does with them,
which might or might not be to make them a Python
dictionary key.

Terry J. Reedy






More information about the Python-list mailing list