[Python-3000] PEP 3124 - more commentary (original) (raw)

Phillip J. Eby pje at telecommunity.com
Tue May 15 18:25:24 CEST 2007


At 08:32 AM 5/15/2007 -0700, Guido van Rossum wrote:

Not so good; I expect the overloads could be written by different authors or at least at different times. Why can't you dynamically update the dispatcher when an overloading with more arguments comes along?

You mean by changing its code? The code to generate the tuple goes in the original function object generated by @abstract or @overloadable.

If we can't specify the count in advance, the remaining choices appear to be:

Of these, I lean towards the third, but I imagine you'll like one of the other two better. :)

If we don't do one of these things, the performance of functions that have *args but don't want to dispatch on them will suffer enormously due to the need to loop over *args and create a dynamic-length tuple. (As shown by the performance tests you did on your tuple dispatch prototype.)

Conversely, if we mutate the function, then even dispatching over *args won't require a loop slowdown; the tuple can always be of a fixed length.



More information about the Python-3000 mailing list