On Sat, Oct 16, 2021 at 6:22 AM Erik Demaine <edema...@mit.edu> wrote:

>
> It's not especially short, and it's not backward-compatible,
> but at least there's a history of adding double-underscore things.
> Perhaps, for backward compatibility, the feature could be disabled in any
> scope (or file?) where __lhs__ is assigned, in which case it's treated
> like a
> variable as usual.  The magic version only applies when it's used in a
> read-only fashion.  It's kind of like a builtin variable, but its value
> changes on every line (and it's valid only in an assignment line).
>

This could probably be toggled via a __future__ import which would make its
usage more apparent to readers of the file. But this would imply that the
keyword would eventually be turned on by default; I don't think there are
any
examples of __future__ imports intended to be left forever as options for
the
programmer.
I would be against any sort of magic replacement-only-when-otherwise-
NameError. It seems to easy to mistakenly change it value because the
namespace of locals or globals changed somewhere else.

Regards,
~ Jeremiah
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/AXG435QEB6T73EPAHEHGM6TYJQL2UW62/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to