This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author peter.otten
Recipients Andesheng, peter.otten
Date 2014-02-28.13:08:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393592895.08.0.254984748737.issue20805@psf.upfronthosting.co.za>
In-reply-to
Content
No, that's not an error. Given a class MyClass and an instance x of that class

>>> class MyClass:
...     def f(self): return 42
... 
>>> x = MyClass()

you usually invoke a method like so:
>>> x.f()
42

But it is also possible to break that in two steps
(1) get the "bound method" and store it in a variable for later use:

>>> xf = x.f

(2) call the "bound method" as often as you like:
>>> xf()
42
>>>

"bound method" means that the method "remembers" the instance it is associated with (x in the above example).

Gene, while you are still learning the language please ask on the python-tutor mailing list first before resorting to the bug tracker.
History
Date User Action Args
2014-02-28 13:08:15peter.ottensetrecipients: + peter.otten, Andesheng
2014-02-28 13:08:15peter.ottensetmessageid: <1393592895.08.0.254984748737.issue20805@psf.upfronthosting.co.za>
2014-02-28 13:08:15peter.ottenlinkissue20805 messages
2014-02-28 13:08:14peter.ottencreate