On Fri, May 24, 2013 at 8:53 PM, Steven D'Aprano <st...@pearwood.info> wrote:
> Python built-ins and the standard library already have a standard idiom for
> specifying multiple values at once. A tuple of types is the One Obvious Way
> to do this:
>
> @fun.register((float, Decimal))

It's not obvious, it's ambiguous - some third party libraries use that
notation for multi-method dispatch, and they always will, no matter
what notation we choose for the standard library.

We have three available notations to register the same function for
multiple types: stacked decorators, tuple-of-types and multiple
arguments.

Of those, the first we *cannot avoid* supporting, since we want to
return the undecorated function regardless for pickle support and ease
of testing.

The second two are both used as notations by existing third party
multiple dispatch libraries.

Thus, your request is that we add a second way to do it that is
*known* to conflict with existing third party practices. There is no
practical gain on offer, it merely aligns with your current sense of
aesthetics slightly better than stacked decorators do. While you're
entitled to that aesthetic preference, it isn't a valid justification
for adding an unneeded alternate spelling.

Furthermore, the proposed registration syntax in the PEP is identical
to the syntax which already exists for ABC registration as a class
decorator (http://docs.python.org/3/library/abc#abc.ABCMeta.register).

Cheers,
Nick.

--
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to