2009/9/1 Brett Cannon <[email protected]>: > On Tue, Sep 1, 2009 at 07:21, Benjamin Peterson<[email protected]> wrote: >> 2009/8/31 xiaobing jiang <[email protected]>: >>> My idea is: here, the two functions (or maybe classes) should have the >>> same behavior). >>> so is this a bug or something I missing ? >> >> I think they should both not check their arguments in __init__ to >> allow for duck typing. > > But what is the point of wrapping something with classmethod or > staticmethod that can't be called? It isn't like it is checking > explicitly for a function or method, just that it can be called which > seems reasonable to me (unless PyCallable_Check() is as off as > callable() was).
Well, if checking if tp_call is not NULL is as bad as callable, then yes. I don't see any reason to use staticmethod or classmethod with a non-callable, but to be consistent, I would, given the choice between removing code and adding another type check, perfer to remove a type check. -- Regards, Benjamin _______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
