> Perhaps you might be able to do what you want using an import hook. I have > done some experiments with introducing some new operators that way: > https://github.com/aroberge/experimental/blob/master/experimental/transformers/readme.md
Thanks for the link, it is a very interesting module. I have to confess there is one more level of intention I have not talked about ... it is about analyzing the python VM code and translate it to C++/SystemC/Verilog or even doing direct synthesis to hardware basic building blocks (think about AND/OR gates, Flip-Flops etc.). So basically we need a way to tell the difference of a "<-" arrow assign from the normal assign. So having source code modification is definitely an interesting idea, but difficult for this second step to proceed. As one of the first step of checking if a module/function is synthesize-able is to make sure it does NOT just call arbitrary functions. (but of course I can try to decorate the function in certain ways ... but then you have to force this policy to all users for their logic block definitions ... I really wanted an almost one-to-one mapping between a python function to a hardware block ... without even a single decorator ...). I will give it a deeper try to see how far I can go though with this library (it has a few hundred lines of code but supporting arrow operators in python is really just below 100 lines of code ..) _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/