[Python-Dev] why different between staticmethod and classmethod on non-callable object?

Brett Cannon brett at python.org
Tue Sep 1 20:36:13 CEST 2009


On Tue, Sep 1, 2009 at 07:21, Benjamin Peterson<benjamin at python.org> wrote:
> 2009/8/31 xiaobing jiang <s7v7nislands at gmail.com>:
>> 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).

-Brett


More information about the Python-Dev mailing list