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/2010-June/100577.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?Christian Heimes lists at cheimes.de
Sun Jun 13 01:03:44 CEST 2010
> method or instancemethod perhaps?

The necessary code is already in Python 3.0's code base. I've added in
in r56469 as requested in my issue http://bugs.python.org/issue1587. It
seems we had this very discussion over two and a half year ago.

Index: Python/bltinmodule.c
===================================================================
--- Python/bltinmodule.c        (Revision 81963)
+++ Python/bltinmodule.c        (Arbeitskopie)
@@ -2351,6 +2351,7 @@
     SETBUILTIN("frozenset",             &PyFrozenSet_Type);
     SETBUILTIN("property",              &PyProperty_Type);
     SETBUILTIN("int",                   &PyLong_Type);
+    SETBUILTIN("instancemethod",        &PyInstanceMethod_Type);
     SETBUILTIN("list",                  &PyList_Type);
     SETBUILTIN("map",                   &PyMap_Type);
     SETBUILTIN("object",                &PyBaseObject_Type);


>>> class Example:
...     iid = instancemethod(id)
...     id = id
...
>>> Example().id()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: id() takes exactly one argument (0 given)
>>> Example().iid()
139941157882144

Christian

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