[Python-ideas] Operator as first class citizens -- like in scala -- or yet another new operator?

Ricky Teachey ricky at teachey.org
Fri May 24 09:44:55 EDT 2019


Another idea if you really want to be able to do `foo = 5` and have it
behave the way you want:

Create a custom dictionary type to hold locals() (and perhaps globals() if
needed). Unless I'm wrong, that dict type can pretty much do whatever you
want, including overriding assignment behavior. Then just run the code
using exec(), passing the custom hdl_locals().

You could package up a custom python interpreter for hardware programming
which simply execs() the python code using this customized assignment
behavior provided by hdl_locals(). Such a customized namespace is a very
pythonic approach, and if I understand correctly, most regular non hdl
python would probably be able to run.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190524/8bbab179/attachment.html>


More information about the Python-ideas mailing list