←back to thread

160 points leontrolski | 2 comments | | HN request time: 0.389s | source
Show context
nemoniac ◴[] No.41887341[source]
You could argue that this is not merely adding syntax, but also adding the associated semantics.

Anyway, if you found this interesting, you might enjoy Eli Bendersky's blog post from nearly 15 years ago where he adds an "until ... do" statement to Python.

https://eli.thegreenplace.net/2010/06/30/python-internals-ad...

replies(3): >>41887390 #>>41887410 #>>41888115 #
1. asplake ◴[] No.41887410[source]
I sometimes think it would be fun to do “do: ... where:/while/until”, wherein the “where” part does local bindings.
replies(1): >>41887890 #
2. tpoacher ◴[] No.41887890[source]
there is a nice "staticscope" package in python, which acts as a context manager, and does pretty much what you refer to. pretty neat.

https://pypi.org/project/scoping/