A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-June/100572.html below:

[Python-Dev] Are PyCFunctions supposed to invisibly consume self when used as a method?

[Python-Dev] Are PyCFunctions supposed to invisibly consume self when used as a method? [Python-Dev] Are PyCFunctions supposed to invisibly consume self when used as a method?Guido van Rossum guido at python.org
Sat Jun 12 03:30:36 CEST 2010
On Fri, Jun 11, 2010 at 5:41 PM, Benjamin Peterson <benjamin at python.org> wrote:
> 2010/6/11 Brett Cannon <brett at python.org>:
>> This "magical" ignoring of self seems to extend to any PyCFunction. Is
>> this dichotomy intentional or just a "fluke"? Maybe this is a
>> hold-over from before we had descriptors and staticmethod, but now
>> that we have these things perhaps this difference should go away.
>
> There are several open feature requests about this. It is merely
> because PyCFunction does not implement __get__.

Yeah, but this of course is because before descriptors only Python
functions were special-cased as methods, and there was known code that
depended on this. I'm sure there's even more code that depends on this
today (because there is just more code, period :-).

Maybe we could offer a decorator that adds a __get__ to a PyCFunction though.

-- 
--Guido van Rossum (python.org/~guido)
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