On 03/07/2020 21:55, Rob Cliffe wrote:
    I don't like the .name syntax (grit on Tim's monitor; does not suggest the meaning).  Nor am I keen on "expressions" being interpreted differently after 'case' than elsewhere in Python.  But I don't know what syntax (where necessary) to suggest.     I'm not keen on special treatment of the '_' variable, and would prefer to be able to use 'else:' after 'match'.

+1

I think using else would be sensible since it has similar behaviour in the rest of Python and it would immediately make sense to anyone seeing the syntax for the first time (provided they understood what the rest of the match block does). If objections were moved against it I seem to have missed them (in my defence, the discussion on PEP622 has been quite fragmented and I haven't been on this list for very long).

I also don't like the .name syntax and for what little it's worth, I personally would have a hard time getting used to it if it were adopted. Has anyone proposed introducing ` ` quotes for this purpose? They could enclose references without ambiguity and could even be used elsewhere in Python to enclose identifiers, for example to allow spaces and symbols in them (which I wouldn't regard as particularly good style, but it may still come in handy). They are used in MySQL, bash and Markdown to enclose expressions or identifiers, so I feel no experienced programmer would have a hard time wrapping their head around it. Though I'd understand if it were problematic for Python's parser.

Another option would be to wrap references in {} in a similar way to what happens in fstrings.

Another option still could be to wrap references in quotes, like strings, and require use of str("some string") to catch literal strings, but I don't know if I like this myself.

Either way, I seem to prefer symmetric marks to signal references; I don't know if anyone else shares this sentiment.

_______________________________________________
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/QJ7ET7V4YLLUL7YVZZWVRFHPP4L3WZPH/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to