News for hackers. Stuff that matters.
Re:Python goto implemented with system trace function (2017) by kzrdude on Tuesday May 05, 2020 @11:29AM (#23081072)
Python being python, can't you swap out the import machinery and change which compile function is called, alternatively call your own preprocessor before compiling?
Re:Python goto implemented with system trace function (2017) by rcxdude on Tuesday May 05, 2020 @12:40PM (#23081925)
Yup. You can basically write your own language with different syntax and get python to treat it like any other python code. Hy is a language which works this way: https://github.com/hylang/hy (see this part of their documentation for how the user can use this: https://docs.hylang.org/en/master/language/interop.html#usin...)

I think goto has been implemented in a few different ways in python. Here's another example which abuses existing syntax and edits the bytecode of the function after its compiled: https://pypi.org/project/goto-statement/

Re:Python goto implemented with system trace function (2017) by sitkack on Wednesday May 06, 2020 @01:41AM (#23088188)