Stuck with metaclass
Bengt Richter
bokr at oz.net
Sat Nov 22 13:46:48 EST 2003
On Sat, 22 Nov 2003 18:50:24 +0100, Fernando Rodriguez <frr at easyjob.net> wrote:
>Hi,
>
>I have a class Preconditions that has a metaclass (MetaChecker), but I guess I
>somehow screwed things up with the metaclass definition...
>
>When I create an instance of Preconditions, I get the doc string instead! =:-O
>If I remove the metaclass statemente, everythign works fine.
>
>Any help would be greatly appreciated. O:-)
>
>here's my code:
>
Two suggestions:
For for a more generally useful return value
> args = inspect.getargspec(fn)[0]
return len(args) == n
>
and to fix the misleading symptom you observed
> return type.__new__(cls, name, bases, attribs)
return type.__new__(cls, clsname, bases, attribs)
(No guarantee that's the end of it ;-)
Regards,
Bengt Richter
More information about the Python-list
mailing list