Russell E. Owen wrote: > I have several situations in my code where I want a unique identifier > for a method of some object (I think this is called a bound method). I > want this id to be both unique to that method and also stable (so I can > regenerate it later if necessary).
>>> def persistent_bound_method(m): ... return m.im_self.__dict__.setdefault(m.im_func.func_name, m) ... >>> class A: ... def x(self): ... return ... >>> a=A() >>> a.x is a.x False >>> persistent_bound_method(a.x) is persistent_bound_method(a.x) True >>> -- http://mail.python.org/mailman/listinfo/python-list