Ooops. My proof on anti-concept has a flaw.  It only "shadows" names that
already exist.  Presumably that's the wrong idea, but it's easy enough to
change if desired.

On Sun, Apr 29, 2018 at 5:24 PM, Paul Moore <p.f.mo...@gmail.com> wrote:

> On 29 April 2018 at 21:20, Tim Peters <tim.pet...@gmail.com> wrote:
> > As covered most recently in an exchange with Tim Delaney, best I can
> > tell absolutely nobody has wanted that.  By "sublocal scope" they
> > don't mean a full-fledged new scope at all, but a kind of limited
> > "shadowing" of a handful of specific, explicitly given names.  It acts
> > like a context manager, if there were a way to clearly spell
> >
> >     save the current state of these specific identifiers at the start (&
> I
> >         couldn't care less whether they're local, nonlocal, or global - I
> >         don't know & don't care)
> >
> >     then execute the code exactly as if this gimmick had never been used
> >
> >     then, at the end, restore the specific identifier states we saved
> > at the start
>
> So maybe adding such a primitive (maybe something live states =
> sys.get_variable_state('a', 'b', 'c') and
> sys.set_variable_state(states)) would be useful? Of course, we've
> moved away from real use cases and back to theoretical arguments now,
> so it's entirely possible that doing so would only solve problems that
> no-one actually has... David Mertz' sublocal context manager would be
> a good prototype of such a thing - at least good enough to demonstrate
> that it's of no benefit in practice <wink>
>
> Paul
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to