I have a python class with "emulated" static properties via a metaclass:
class MyMeta(type):
@property
def x(self): return 'abc'
@property
def y(self): return 'xyz'
class My: __metaclass__ = MyMeta
Now some of my functions receives the property name as a string, which should be retrieved from My.
def property_value(name):
return My.???how to call property specified in name???
The point here is that I don't want an instance of My to be created.
Many thanks,
Ovanes
You could use
getattr(My,name)