From: Neal N. <ne...@me...> - 2002-07-23 03:43:40
|
Jeremy Hylton wrote: > > Note that it isn't obvious to me how to recognize a class method vs. a > regular method. In particular, for the few metaclasses I've written, Me neither, that's why I haven't done anything. Well, ok, it's one of the reasons. :-) > I've used a different variable for __new__() than for __init__(). The > first argument to __new__() is the metaclass and I use the variable > meta. The first argument to __init__() is the class and I use the > variable cls. (There's an example if Demo/newmetaclasses/Eiffel.py.) > > Perhaps the pattern is simple because __new__() is the only special > case, but it's not clear that self / cls / meta is a widely used > pattern. > > Rather than try to enforce a particular behavior, I'd be happier to > disable the warning. Agreed. Also if the variable could be configured, so the classmethod's first arg could be cls | klass | c | whatever. But default would need to be no checking. I won't make the same mistake again with the self warning not being able to be turned off easily. Neal |