
Why not use '=' to distinguish binding from equality testing: case Point(x, =y): # matches a Point() with 2nd parameter equal to y; if it does, binds to x.
This would allow a future (or present!) extension to other relative operators: case Point(x, >y): (although the syntax doesn't AFAICS naturally extend to specifying a range, i.e. an upper and lower bound, which might be a desirable thing to do. Perhaps someone can think of a way of doing it).
Whether case =42: case 42: would both be allowed would be one issue to be decided. Rob Cliffe My preference would be that we mark where to bind as opposed to what is a constant. Forgetting to mark a constant that has been bound to a name runs the risk of changing that 'constant' (since Python doesn't support marking a name as a constant). Forgetting to mark a name to bind may
On 7/7/20 10:08 PM, Rob Cliffe via Python-Dev wrote: likely cause a run time error if it hasn't been bound yet, or at the very least probably fails in a 'safer' way. I think forgetting to add a special mark is a much more likely error than adding a mark by mistake (unless the mark is just havig a dot in the name). -- Richard Damon