News for hackers. Stuff that matters.
Re:How Hy backported “yield from” to Python 2 by kazinator on Friday November 21, 2014 @02:25PM (#8642853)
We can look at it like this.

You essentially have macros in Python: they are hard-coded in the form of phrase structure rules in its grammar.

Macros are essentially this: new phrase structure rules in your interpreter/compiler that you program yourself and stick into your application.

What you're really saying is actually that you don't need any new macros beyond the phrases which the benevolent dictator for life has bestowed upon you in the parser.

Whenever a programmer upgrades to a newer Python which has new syntactic transformations in its updated grammar, and then uses these new things, that programmer contradicts his or her earlier claims that no new macros were needed.

Re:How Hy backported “yield from” to Python 2 by pekk on Friday November 21, 2014 @04:51PM (#8643577)
I don't need everyone else in my shop making horrible sloppy messes at an unnecessarily high level of abstraction using macros. I'll be picking up after their cute shit at the end of the month, under emergency conditions. There's currently no problem with them recompiling Python to make weird one-off syntax because that's clearly crossing a line. I could add my own syntax and recompile, but I legitimately don't need or want to. No, I don't need a general runtime macro capability in Python. It's not a good idea and it doesn't buy anything I actually need.
Re:How Hy backported “yield from” to Python 2 by orbifold on Saturday November 22, 2014 @08:50AM (#8645538)
Take OCaml for comparison: It has a more or less reasonable way of extending the language with an extensible parser camlp4 that ultimately yields a fixed AST. No one would get the idea to use it just for fun, or one-shot abstractions, but it is integrated into the toolchain well enough that you can reliably distribute libraries that use syntax extensions. The general attitude that "coders are dumb, we need to protect them from themselves" lead to the development of mediocre languages like Java. Compare that to something like Racket, where despite some flaws most of the macros provide an obvious and very real benefit, without overcomplicating the compiler (for example the match macro, or the macros that constitute the C-FFI). Ideally in my eyes a language should provide the programmer with maximal possible expressiveness without compromising a core simple design.
Re:How Hy backported “yield from” to Python 2 by agentultra on Friday November 21, 2014 @08:35PM (#8644357)
So... don't use it? Nobody is suggesting we add macros to Python.

Macros do not make code unmaintainable by their virtue alone any more than pointers, references, or any other language feature.

I suggest you look into code review and use some code checking tools like style checkers, linters, and test coverage report generators.

Re:How Hy backported “yield from” to Python 2 by agentultra on Friday November 21, 2014 @02:59PM (#8643077)
An excellent way of looking at it.

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.

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.