Adding bound methods dynamically... CORRECTED

Devan L devlai at gmail.com
Wed Aug 31 00:22:10 EDT 2005


Kevin Little wrote:
> I want to dynamically add or replace bound methods in a class.  I want
> the modifications to be immediately effective across all instances,
> whether created before or after the class was modified.  I need this
> to work for both old ('classic') and new style classes, at both 2.3
> and 2.4.  I of course want to avoid side effects, and to make the
> solution as light-weight as possible.
>
> Question for the experts: Is the solution coded in AddBoundMethod()
> acceptable to the Pythonian Gods? :) It does seem to work -- tested
> at 2.3.5 (RH Linux) and 2.4.1 (WinXP)
>
> [Code]

I'm not an expert, but why do you need to dynamically add or replace
bound methods?




More information about the Python-list mailing list