[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: Method / Functions - What are the differences?
From: Michael Rudolf <spamfresser () ch3ka ! de>
Date: 2010-02-28 16:39:03
Message-ID: hme677$5ai$1 () news ! urz ! uni-heidelberg ! de
[Download RAW message or body]
Am 28.02.2010 15:08, schrieb Alf P. Steinbach:
> >>> "Hello".upper
> <built-in method upper of str object at 0x00BA16E0>
> >>> f = "Hello".upper
> >>> f
> <built-in method upper of str object at 0x00BA16E0>
> >>> f()
> 'HELLO'
> >>>
> >>>
> >>>
> >>> f.__self__
> 'Hello'
Holy hand grenade.
You have no Idea how enlightened I feel right now :D
Thank you, "bound method" was the term I forgot and your example...
...totally revealed the internals behind this to me. Especially the last
line I quoted.
I mean, I always knew *that* this works, but I never knew *why*.
Regards,
Michael
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic