dunder-docs (was Python is DOOMED! Again!)

Gregory Ewing greg.ewing at canterbury.ac.nz
Tue Feb 3 17:43:48 EST 2015


Marko Rauhamaa wrote:
> Right now Python generates the trampoline from the class prototype every
> time you call a method. If the semantics allowed, you could create the
> trampoline at instantiation time (for better or worse). That way, the
> problem you seem to be referring to wouldn't materialize.

Sorry, I misinterpreted what you were suggesting.

You seem to be suggesting an optimisation that pre-creates
bound methods when the instance is created. Keeping a
cache of bound methods would achieve the same thing
without changing the semantics. I think CPython
might already be doing that, but I'm not sure.

-- 
Greg



More information about the Python-list mailing list