I have submitted a new dynamic function overload in the Subversion sandbox of Python. Despite "(Dynamic or Run) overload function [(Dynamically, or Run-Time) Overloaded Functions]" This term is criticized by all parties, I still have to continue to talk about it. "(Dynamic or Run) overload function" can also be called generic functions, multi-mathods or dispatch, which also criticized. Everyone can see a slightly optimized implementation at http://svn.python.org/view/sandbox/trunk/overload/. Phillip eby once said that my realization is too slow, but I suggest you run Test_OverLoading.py to see how your situation. (This requires Python 2.5A 1, Python.org just released this version.) Phillip also suggests that I use IssubClass (), not to rely on the method to resolute order (MRO). He believes that MRO methods will lead to false accuracy. I don't know if it will be like this, because for a single dispatch, my method does match the class method. Of course, this requires many additional features or potential requirements. For example, is there any mechanism for calling "next" available methods? However, the algorithm does not clearly generate the next method. In addition, if there is ambiguity, it should throw an exception or call the default method (or "next" method, if we can reach a unintended it)? For optimization, I believe in generation (code generation) allows the overloaded function and the handwritten function runs as fast as the handwritten function. See accelerated in Test_OverLoading.py. This does not apply Python 2.5. This is a controversial topic, so I should go to Python3000 (perhaps as a third-party attachment of Python 2.5). About a year ago, I have written the blog of the relevant topics, but I forgot to have such a thing. Compared with today's situation, the implementation of the time is dim. It seems that PLILLIP's proposal is also very busy. I hope to finalize PyProtocols out of the market. PLILLIP should be proud of me. Bamboo
(Original link URL: http://www.Artima.com/weblogs/viewpost.jsp? Thread = 155514; Guido Van Rossum English blog URL: http://www.Artima.com/weblogs/index.jsp? Blogger = Guido)