A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-June/080253.html below:

[Python-Dev] update_wrapper should preserve staticmethod behavior

[Python-Dev] update_wrapper should preserve staticmethod behaviorAntoine Pitrou solipsis at pitrou.net
Wed Jun 11 21:22:49 CEST 2008
Calvin Spealman <ironfroggy <at> socialserve.com> writes:
> 
> staticmethod doesn't wrap anything, it just creates a descriptor on  
> the class with a __get__ that returns the original, untouched  
> callable. Doesn't even care _what_ the thing you use it on is  
> (function, other callable, or something else entirely.)

FWIW, I still disagree. Technically, it might not "wrap" anything (in the sense
that it isn't defined as a function returning another function - which is a
narrow definition of a wrapper by the way), but semantically it does. To the
non-expert programmer, it is a decorator like any other one. The fact that it is
implemented differently from other decorators is not an excuse for it to follow
different rules...

Unless, of course, there is a good *semantic* reason for staticmethod not to
mirror the __module__ attribute.

(by the way, does the same apply to classmethod as well?)

Regards

Antoine.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4