On Tue, 14 Feb 2006 22:24:12 -0500, rumours say that Terry Reedy
[EMAIL PROTECTED] might have written:
id(Parrot.f) == id(Parrot.f)
True
id(Parrot.__dict__) == id(Parrot.__dict__)
True
A wrapper is created and passed to id() which returns an int object while
releasing the wrapper back to
I came across this unexpected behaviour of getattr for new style classes.
Example:
class Parrot(object):
... thing = [1,2,3]
...
getattr(Parrot, thing) is Parrot.thing
True
getattr(Parrot, __dict__) is Parrot.__dict__
False
I would have expected that the object returned by getattr would
Steven D'Aprano wrote:
I came across this unexpected behaviour of getattr for new style classes.
Example:
class Parrot(object):
... thing = [1,2,3]
...
getattr(Parrot, thing) is Parrot.thing
True
getattr(Parrot, __dict__) is Parrot.__dict__
False
hint:
getattr(object,
Steven D'Aprano wrote:
I came across this unexpected behaviour of getattr for new style classes.
Example:
class Parrot(object):
... thing = [1,2,3]
...
getattr(Parrot, thing) is Parrot.thing
True
getattr(Parrot, __dict__) is Parrot.__dict__
False
I would have expected that the
On Tue, 14 Feb 2006 04:11:52 -0800, Raymond Hettinger wrote:
Steven D'Aprano wrote:
I came across this unexpected behaviour of getattr for new style classes.
Example:
class Parrot(object):
... thing = [1,2,3]
...
getattr(Parrot, thing) is Parrot.thing
True
getattr(Parrot,
Raymond Hettinger wrote:
Steven D'Aprano wrote:
I came across this unexpected behaviour of getattr for new style classes.
Example:
class Parrot(object):
... thing = [1,2,3]
...
getattr(Parrot, thing) is Parrot.thing
True
getattr(Parrot, __dict__) is Parrot.__dict__
Steven D'Aprano wrote:
class Parrot(object):
... thing = [1,2,3]
...
getattr(Parrot, thing) is Parrot.thing
True
getattr(Parrot, __dict__) is Parrot.__dict__
False
hint:
getattr(object, '__dict__')
dictproxy object at 0x2ab2ff30
That doesn't answer the
On Tue, 14 Feb 2006 13:03:17 +0100, bruno at modulix wrote:
Steven D'Aprano wrote:
I came across this unexpected behaviour of getattr for new style classes.
Example:
class Parrot(object):
... thing = [1,2,3]
...
getattr(Parrot, thing) is Parrot.thing
True
getattr(Parrot,
Carl Banks [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
But wait, it gets weirder.
Not weird at all. Just an artifact of CPython's storage recycling
algorithm.
id(Parrot.f) == id(Parrot.f)
True
id(Parrot.__dict__) == id(Parrot.__dict__)
True
A wrapper is created and passed