Larry Hastings wrote:

> As for leveraging the convention of using '_' for values you don't care 
> about in Python--that's actually why I /don't/ like it as the wildcard 
> pattern.  To date, everyone who uses '_' understands it's just an 
> identifier, no different from any other identifier.

Not quite... I understand it more like a file in /tmp 
I don't use it for anything I will want later, just in case.

> However, if I understand PEP 622 correctly, the places you use '_' as 
> the wildcard pattern are also places where you could put an identifier.  
> But in this one context, '_' doesn't behave like the other identifiers, 
> even though in every other context in Python it still does.  This is the 
> "special case" that "breaks the rules" I alluded to above.
> Consistency with the longstanding semantics of '_', and consistency with 
> other identifiers, is much more important to me than consistency with 
> other languages for the pattern matching wildcard token.

If a normal variable name is re-used, I would expect it to have the same 
meaning.

I know that "case x, x:" as shorthand for "case x, __x if x == __x:" has been 
postponed, but it could still happen later, and it would be a problem if that 
ever became legal without requiring the two bindings to match.  I do NOT assume 
that they will match if the variable happens to be _, though I suppose others 
might.

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

Reply via email to