[Python-Dev] Accessing globals without dict lookup (original) (raw)
Fred L. Drake, Jr. fdrake@acm.org
Fri, 8 Feb 2002 16:04:28 -0500
- Previous message: [Python-Dev] Accessing globals without dict lookup
- Next message: [Python-Dev] Accessing globals without dict lookup
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum writes:
Oops, I was indeed confused. I think I meant this:
def keys(self): return [k for k, c in self.__dict.iteritems() if c.objptr is not NULL]
Was I not clear, or am I missing something entirely? keys() needs no special treatment, but items() and values() do:
class celldict(object): ...
def keys(self):
return self.__dict.keys()
def items(self):
return [k, c.objptr for k, c in self.__dict.iteritems()
if c.objptr is not NULL]
def values(self):
return [c.objptr for c in self.__dict.itervalues()
if c.objptr is not NULL]
-Fred
-- Fred L. Drake, Jr. PythonLabs at Zope Corporation
- Previous message: [Python-Dev] Accessing globals without dict lookup
- Next message: [Python-Dev] Accessing globals without dict lookup
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]