Alternate Syntax for dictionary elements
Alex Martelli
aleaxit at yahoo.com
Tue Jul 3 17:02:22 EDT 2001
"Skip Montanaro" <skip at pobox.com> wrote in message
news:mailman.994188607.18864.python-list at python.org...
...
> class Dict(UserDict.UserDict):
> def __getattr__(self, name):
> if name == "data":
> return self.__dict__['data']
Dead-code warning: __getattr__ is NOT called for attribute
names that are keys in self.__dict__. You can remove these
two lines without ill effect:-).
Alex
More information about the Python-list
mailing list