On 2021-05-27 at 22:33:25 +1000,
Steven D'Aprano <st...@pearwood.info> wrote:

> Aside from globals, which we agree are Considered Harmful, you've 
> suggested two alternative implementations:
> 
> - something with closures;
> 
> - hidden state in an object with a `__call__` method.
> 
> Closures are cool, but the hidden state really is inaccessible from 
> outside the function. (At least I've never worked out how to get to it.) 
> So the callable object is better for introspection and debugging.

Then fix your debugger.  ;-)

As I recall, you're a proponent of fixing what's broken rather than
creating workarounds.

(I also recall many discussions regarding failed sandboxes because of
Python's nearly infinite capacity for introspection.  Maybe closures are
the path to a true sandbox.)

Globals, persistent locals, closures, statics, class variables, instance
variables, etc. are all just different ways to hide state.  IMO, we
don't need another one.
_______________________________________________
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/LOB2FKM5XV3Y3TGQB532G7F2RF4JOHLN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to