Speed: bytecode vz C API calls

Terry Reedy tjreedy at udel.edu
Wed Dec 10 15:34:28 CET 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.


More information about the Python-list mailing list