Jp Calderone wrote: > I'd skip that, though. Your problem doesn't sound "Metaclass!" at me. > I wonder if you could elaborate on your usage? Perhaps there's a better > solution which doesn't involve metaclasses at all.
I suspect he could *maybe* get by without the metaclass, but not without custom descriptors, which don't always work for classic classes. In particular, if a Java exception has a static method, he'll want to map that to a Python classmethod or staticmethod, and as far as I recall, that stuff just doesn't work with classic classes. In particular, if a Java class has both a static method and a non-static method of the same name, there's no way that I know of to map it into Python using a classic class; you *have* to have a metaclass with a data descriptor in order to prevent a __dict__ lookup on the class itself. The only solution I can think of for this is to only use metaclasses if you have the static/non-static naming conflicts, or other features of the mapped class that require using a metaclass or other newstyle-only features. Or, alternatively, force all Throwable subclasses to be implemented as classic classes. :( -- http://mail.python.org/mailman/listinfo/python-list