On 2020年06月24日 13:37, Antoine Pitrou wrote:
On 2020年6月24日 21:54:24 +1200 Greg Ewing <[email protected]> wrote:On 24/06/20 5:20 am, Antoine Pitrou wrote: > suddently `Point(x, 0)` means something entirely > different (it doesn't call Point.__new__, it doesn't lookup `x` in the> locals or globals...).This is one reason I would rather see something explicitly marking names to be bound, rather than making the binding case the default. E.g.case Point(?x, 0): This would also eliminate the need for the awkward leading-dot workaround for names to be looked up rather than bound.That looks quite a bit better indeed, because it strongly suggests that something unusual is happening from the language's POV. Thank you for suggesting this.
Could the name be omitted when you're not interested in the value? case Point(?, 0):
One other thing that the PEP doesn't make clear -- is it possible to combine '=' and ':=' to match a keyword argument with a sub pattern and capture the result? I.e. can you write case Spam(foo = foo_value := Blarg()):Yuck :-S
_______________________________________________ Python-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/TQYW7GRPXWNHM7NWDKVQZCDZZBFZYVHN/ Code of Conduct: http://python.org/psf/codeofconduct/