Dynamically adding and removing methods
rrr at ronadam.com
Wed Sep 28 20:05:12 CEST 2005
Steven D'Aprano wrote:
> On Tue, 27 Sep 2005 16:42:21 +0000, Ron Adam wrote:
>>>>>>>def beacon(self, x):
>>>>... print "beacon + %s" % x
>>>Did you mean bacon? *wink*
>>Of course... remembering arbitrary word letter sequences is probably my
>>worst skill. ;-) That, and I think for some reason the name Francis
>>Beacon was in my mind at the time.
> I think you mean Francis Bacon *wink*
Yes, I mean him, Beacon is his fathers sirname. I'm not sure if Francis
changed it or if his father did. (?)
> This clearly shows that assigning a function to a class attribute invokes
> whatever machinery Python uses to turn that function into a true method,
> but assigning it to an instance does not.
Actually I think I'm getting more confused. At some point the function
is wrapped. Is it when it's assigned, referenced, or called?
More information about the Python-list