Class Variable Access and Assignment
Antoon Pardon
apardon at forel.vub.ac.be
Mon Nov 7 03:28:49 EST 2005
More information about the Python-list mailing list
Mon Nov 7 03:28:49 EST 2005
- Previous message (by thread): Class Variable Access and Assignment
- Next message (by thread): Class Variable Access and Assignment
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Op 2005-11-04, Christopher Subich schreef <csubich.spam.block at spam.subich.block.com>: > Antoon Pardon wrote: >> Well I wonder. Would the following code be considered a name binding >> operation: >> >> b.a = 5 > > Try it, it's not. > > Python 2.2.3 (#1, Nov 12 2004, 13:02:04) > [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-42)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> a > Traceback (most recent call last): > File "<stdin>", line 1, in ? > NameError: name 'a' is not defined > >>> b = object() > >>> b.a > Traceback (most recent call last): > File "<stdin>", line 1, in ? > AttributeError: 'object' object has no attribute 'a' > > Once it's attached to an object, it's an attribute, not a base name. So? It is still a name and it gets bound to an object. Sure the name is bound within a specific namespace but that is IMO a detail. > unified for Py3k, but in cases like this the distinction is important. But part of this dicussion is about the sanity of making these kind of distinctions. Since they apparantly plan to get rid of them in Py3k, I guess I'm not the only one questioning that. -- Antoon Pardon
- Previous message (by thread): Class Variable Access and Assignment
- Next message (by thread): Class Variable Access and Assignment
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list