S
Steve Menard
As par of JPype, I find that I have to brifge Java static members into
class attributes.
I am using a metaclass to dynamically create a Python class for every
Java type encountered. Instance variables were handled by adding a
property(get, set) to the class's dictionary.
Now static members are giving me a headache. I cannot use "property" for
them, because properties are for instances only.
What I am currently doing is adding a __getattr__ and a __setattr__
methods to the metaclass, which is called when a class attribute is
requested but not found in the class' dict.
This works fine exact it does not walk the inheritance tree to find
static members defined in base classes. I am currently adding up all the
names in every class. This "works", however it is misleading when you do
a dir() of the class.
Does anyone have an idea how to implement "classproperty" ?
Thanks in advance for any help,
Steve
class attributes.
I am using a metaclass to dynamically create a Python class for every
Java type encountered. Instance variables were handled by adding a
property(get, set) to the class's dictionary.
Now static members are giving me a headache. I cannot use "property" for
them, because properties are for instances only.
What I am currently doing is adding a __getattr__ and a __setattr__
methods to the metaclass, which is called when a class attribute is
requested but not found in the class' dict.
This works fine exact it does not walk the inheritance tree to find
static members defined in base classes. I am currently adding up all the
names in every class. This "works", however it is misleading when you do
a dir() of the class.
Does anyone have an idea how to implement "classproperty" ?
Thanks in advance for any help,
Steve