Re:How Hy backported “yield from” to Python 2
by pekk on Friday November 21, 2014 @04:54PM
(#8643594)
> You have eval, compile, and the ast module.
Using this to write normal code is also a bad idea and a maintenance nightmare. The issue isn't that it is tedious and cumbersome to do so. If it's tedious and cumbersome to make my life hell, that's a feature.
Re:How Hy backported “yield from” to Python 2
by agentultra on Friday November 21, 2014 @08:36PM
(#8644361)
Oh... you must ban the use of the namedtuple function in the collections module then. How unfortunate. It's pretty useful.
Hy is essentially a self-evaluating macro that spits out Python AST.
So you can use map, filter, and friends just as easily on Hy code as you can elements in a list or tuple.
In the end you get Python AST. We generate all of the boiler plate instead of writing it out.
You also do "have" macros in a very obtuse way in Python. You have eval, compile, and the ast module. You can write code, in Python, to modify or generate Python code. It's just tedious and cumbersome in a language where the code is not also data.