[Python-ideas] "Sum" Type hinting [was: Type hinting for path-related functions]
Nick Coghlan
ncoghlan at gmail.com
Wed May 18 23:17:14 EDT 2016
On 19 May 2016 at 08:53, Guido van Rossum <guido at python.org> wrote:
> The one thing that Python doesn't have (and mypy doesn't add) would be
> a match statement. The design of a Pythonic match statement would be
> an interesting exercise; perhaps we should see how far we can get with
> that for Python 3.7.
If it's syntactic sugar for a particular variety of if/elif/else
statement, I think that may be feasible, but you'd presumably want to
avoid the "Can we precompute a lookup table?" quagmire that doomed PEP
3103's switch statement.
That said, for the pre-computed lookup table case, whatever signature
deconstruction design you came up with for a match statement might
also be usable as the basis for a functools.multidispatch() decorator
design.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list