PEP 622 proposes a special use for _: to match anything, discarding the 
whatever value matches.  (If I understand.)  This aligns with the way _ is 
conventionally used in other statements.  This special use in case 
statements feels weird given that _ is otherwise just an ordinary 
variable.  It may even have a value going into the case/match statement, 
which would be ignored.

Has there been any discussion on deprecating use of _ as an R-value?  In 
other words, making _ a "black hole" variable "preposition" into which 
values go but never come out?  Besides the benefit of unifying the 
conventional use of _ with its proposed use  in case/match statements, 
another benefit for CPython would be that _ would no longer hang onto 
references and would therefore not prevent garbage collection of whatever 
was put into it.

Best,

Neil
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/B5W3ZNF4RCJYQP3QNKLMWUXBU2SY4UWT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to