id() collisions on bound methods [was: metaclass and customization with parameters]

Greg Ewing greg at cosc.canterbury.ac.nz
Thu Oct 7 05:57:55 CEST 2004


Jeff Epler wrote:
> In the Olden Days, "caching" bound methods would have led to cycles
> that were never collected.  Nowadays, there's a cyclic GC collector,
> so if that was the killer for this idea maybe it's worth revisiting.

Alternatively, creation of the bound method could be skipped
altogether in the case where it's going to be immediately called.
This could be achieved by having

    obj.meth(args)

generate a single CALL_METHOD opcode instead of an attribute
lookup followed by a call.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list