D
Dan Bentley
class foo(object):
def __getattr__(self, name):
return 42
def e(self, name):
return 2.7
bar = foo()
print bar.baz
bar.__getattr__ = e
print bar.baz
I'd expect this to print:
42
2.7
But instead it prints:
42
42
Is there a way to change the actual __getattr__ used at runtime?
-D"python 2.3.3 on Mac OS X 10.3.4"an
def __getattr__(self, name):
return 42
def e(self, name):
return 2.7
bar = foo()
print bar.baz
bar.__getattr__ = e
print bar.baz
I'd expect this to print:
42
2.7
But instead it prints:
42
42
Is there a way to change the actual __getattr__ used at runtime?
-D"python 2.3.3 on Mac OS X 10.3.4"an