[Python-3000] pep 3124 plans

Guido van Rossum guido at python.org
Sat Jul 21 17:16:12 CEST 2007


On 7/21/07, Joe Smith <unknown_kev_cat at hotmail.com> wrote:
> One of the nice features of Eby's proposal is that more complicated
> dispatching systems can be added. Perhaps some application needs a
> dispatching engine that can dispatch based on the value of an objects
> member. Perhaps the user wants an overload specificly for any product object
> whose price property equals 0. With Eby's system adding a dispatch engine
> that supports that is not difficult.

This is true. However it comes at a cost. Whenever I see an API that
takes a string which is then parsed by the called function as a Python
expression (perhaps constrained to a subset of Python) I cringe,
especially if the common use is to pass a literal. There are just so
many issues with that... It's not colorized by the editor, it's not
syntax-checked by either the editor or the Python parser, it requires
one to build yet another parser...

This is why I don't like the ...when("isinstance(obj, list)") syntax
from (I think) RuleDispatch, and I'm glad it's not in the PEP. I'm
unclear however on how you would do this otherwise -- is overloading
implies() the best approach?

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list