Speed: bytecode vz C API calls

Terry Reedy tjreedy at udel.edu
Wed Dec 10 09:34:28 EST 2003


You presented an example function as taking a type (including new classes)
as parameter.  If your type domain is boundedly finite and preknowable*, you
could precompute the function for *all* inputs and replace the call with a
dict lookup (or bound method for map).

(*) If 'preknowable', could either create classes with factory function that
adds them to cache or give metaclass that does same.

Terry






More information about the Python-list mailing list