Diez B. Roggisch wrote: > Reinhold Birkenfeld wrote: > >> Diez B. Roggisch wrote: >>>> class Foo(type): >>>> def __new__(cls, name, bases, dict): >>>> >>>> for k,v in [(k, v) for k,v in dict.items() if callable(v)]: >>>> cls.wrap(k,v,cls.get_directives(v), dict) >>>> >>>> return super(Foo, self).__new__(self, name, bases, dict) >>> >>> There is a confusion of self and cls above - rename self with cls. >> >> And remove the first argument to __new__. > > Ehm, no, I don't think so. The code was copied and pasted from a working > metaclass (at least I hope so...), and in the original code a underscore > was used for the first argument. I've been following that bad habit for a > while but recently started to be more following to the established > conventions. So I rewrote that code on the fly.
Oh yes. I forgot that __new__ is a staticmethod anyhow. Reinhold -- http://mail.python.org/mailman/listinfo/python-list