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: * Require *args to be annotated :overloadable in order to enable dispatching on them, or * Only enable *args dispatching if the original function has no explicit positional arguments * Mutate the function 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. _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com