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

Michael Hudson mwh at python.net
Thu Oct 7 09:12:03 EDT 2004


Greg Ewing <greg at cosc.canterbury.ac.nz> writes:

> 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.

Been done: http://python.org/sf/709744

Unfortunately, it seems to cause an overall slow DOWN...

Cheers,
mwh

-- 
  SCSI is not magic. There are fundamental technical reasons why it
  is necessary to sacrifice a young goat to your SCSI chain now and
  then.                                                  -- John Woods



More information about the Python-list mailing list