Hi Mohammad,

In addition to what Rhodri James has already well pointed out, here are two additional thoughts on this.

At the moment, the keyword `global` is a marker to say that the respective variable is /modified/ by a function.  Your suggestion would invert that meaning and might therefore add more confusion than what it would solve.

Moreover, to provide yet another alternative, you could also define something along the lines of:
   this = sys.modules[__name__]
and then write:
   MATCH value:
       CASE this.x:
           ...
Of course, this is a bit of a hack and not that much different to using SimpleNamespace.  But it demonstrates that any such keyword would not really add that much power or save any keystrokes.

In the end, I can well imagine that a future version of Python might add something like a "read and compare" marker to patten matching.  But it is probably a good idea to start with a set of fully working but rather minimalistic core features, and then let it grow and evolve with time, guided by real use cases and issues that we run into.

Kind regards,
Tobias
 
_______________________________________________
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/MJGSHTSPUXYCWEYCF5S6QGIMNAFP6ZSY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to