Ethan Furman added the comment:
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.
----------
assignee: -> ethan.furman
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21561>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com