On 14/11/20 7:45 am, Brandt Bucher wrote:
with (using your own syntactic flavor):
```
case >first, *>middle, >last:
     rebuilt = first, *middle, last
case {"key": >value, **>rest}:
     rebuilt = {"key": value, **rest}
case Point(x=>a, y=>b):
     rebuilt = Point(x=a, y=b)

I think this is a case where syntax matters. To my eyes this
looks far less confusing:

case ?first, *?middle, ?last:
     rebuilt = first, *middle, last
case {"key": ?value, **?rest}:
     rebuilt = {"key": value, **rest}
case Point(x=?a, y=?b):
     rebuilt = Point(x=a, y=b)

> (I had to stop and think *hard* where exactly the `>` should go in >`*middle` and `**rest`.

There's a simple rule -- the "?" goes directly in front of the
thing being assigned. You're assigning to 'middle', not '*middle',
so it's '*?middle', not '?*middle'.

I know the same rule applies whatever sigil is being used, but
to my way of thinking, '>' is too easily confused with a comparison
operator. Also it's tempting to interpret '=>' as a single token,
which accidentally happens to make sense here, but could mislead
people into writing '*=>middle' instead of '*>middle'.

--
Greg

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EQQ4Z4YZ7DCSHTMPUL4P33W4VKXWPZ65/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to