In article <[EMAIL PROTECTED]>, Benji York <[EMAIL PROTECTED]> wrote:
>Russell E. Owen wrote: >> The id of two different methods of the same object seems to be the >> same, and it may not be stable either. > >Two facts you're (apparently) unaware of are conspiring against you: > >1) the "id" of an object is consistent for the lifetime of the object, >but may be reused after the object goes away > >2) methods are bound on an as-needed basis and then normally discarded >(unless you do something to keep them around) Thank you and Bengt Richter. You both explained it very well. The current issue is associated with Tkinter. I'm trying to create a tk callback function that calls a python "function" (any python callable entity). To do that, I have to create a name for tk that is unique to my python "function". A hash-like name would be perfect, meaning a name that is always the same for a particular python "function" and always different for a different python "function". That would save a lot of housekeeping. Does the built-in hash function actually do the job? If I centralize all tk callback management and keep objects that represent the tk callback around then I can avoid the whole issue. I was hoping to avoid that, because it complicates housekeeping and adds a risk of memory leaks (at least I think so; right now tk deallocates its callback functions in the few cases I care about so I don't worry about it.) -- Russell P.S. Paolino: thank you also for your kind reply. Your suggestion sounds very useful if I only want a hash for a bound function, but in this case since I want a hash for any callable entity I'm not sure it'll work. -- http://mail.python.org/mailman/listinfo/python-list