[Python-ideas] Match statement brainstorm
SW
walker_s at hotmail.co.uk
Tue May 24 05:31:24 EDT 2016
On 24/05/16 07:08, Greg Ewing wrote:
>> On Mon, May 23, 2016 at 7:57 PM, Michael Selik
>> <michael.selik at gmail.com> wrote:
>>
>>> def demo(arg):
>>> if p, q ?= arg.x, arg.y: # dict structure
>>> elif x ?= arg.x and isinstance(x, int) # assignment + guard
>>> elif a, b, *_ ?= arg: # tuple structure
>>> elif isinstance(arg, Mapping): # nothing new here
>
> I'm unenthusiastic about this -- the above looks like
> an unreadable mess to me.
Agreed.
S
More information about the Python-ideas
mailing list