Message219599
I think something like the following, taken from http://bugs.python.org/issue19030#msg199920, shoud do the trick for something to test against:
class Meta(type):
def __getattr__(self, name):
if name == 'ham':
return 'spam'
return super().__getattr__(name)
class VA(metaclass=Meta):
@types.DynamicClassAttribute
def ham(self):
return 'eggs'
which should result in:
VA_instance = VA()
VA_instance.ham # should be 'eggs'
VA.ham # should be 'spam'
Combining all that with the DynamicClassAttribute should make a fitting test. Thanks, Andreas, for working on that. |
|
Date |
User |
Action |
Args |
2014-06-02 16:05:07 | ethan.furman | set | recipients:
+ ethan.furman, terry.reedy, ned.deily, andymaier |
2014-06-02 16:05:07 | ethan.furman | set | messageid: <1401725107.11.0.816751004187.issue21561@psf.upfronthosting.co.za> |
2014-06-02 16:05:07 | ethan.furman | link | issue21561 messages |
2014-06-02 16:05:06 | ethan.furman | create | |
|