Efficient Wrappers for Instance Methods

Sven R. Kunze srkunze at mail.de
Wed Feb 3 16:12:29 EST 2016


On 03.02.2016 22:06, Bernardo Sulzbach wrote:
> I may say something wrong, but this is what I see going on:
>
> When you get "replace = heapreplace" you are creating a data attribute
> called replace (you will access it by self.replace or
> variable.replace) that is an alias for heapreplace.
>
> When you call x.replace(2) you are calling heapreplace(2), NOT
> heapreplace(self, 2).

It is exactly as you've described it.

Question now is how can I circumvent/shortcut that? There are several 
proposals out there in the Web but none of them works. :-/


Best,
Sven



More information about the Python-list mailing list