On 8/07/20 5:30 am, Paul Sokolovsky wrote:
from __future__ import const

FOO: const = 1

match val:
     case FOO:  # obviously matches by constant's value

This would make it *more* difficult to distinguish constants from
assignment targets when looking at the match statement, unless you
choose names which "look constant-like" somehow.

It also has the general problem of const-declarations in Python.
Currently the compiler only has to analyse one module at a time;
this would require it to also look inside imported modules to
determine whether things were declared const.

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

Reply via email to