3 ms·
Metaprogramming has a runtime cost that macros (even crappy C-like ones) don't. In the case of an interpreted language, this is an important feature. Having sa
by rbanffy 6y ago
Metaprogramming has a runtime cost that macros (even crappy C-like ones) don't. In the case of an interpreted language, this is an important feature.
Having said that, I haven't seen metaprogramming being overused or abused much in Python.
- 10000truths 6y agoYou shouldn't be using Python in the first place if you're worried about the runtime cost of metaprogramming.
- rbanffy 6y agoIf macros offer the same benefit at no additional cost, why not?
- formerly_proven 6y agoMacros have decidedly nonzero cost. Look at the discussion from the core devs surrounding this; just the implementation is a major change for the parsing and AST modules with unclear performance implications. Introducing this much complexity to the language is far from "no cost" as well. I predict that if this PEP goes through, it will be a watershed moment for Python and the language will become an unrecognizable mess (more so than already) within a few years. If GvR was still in charge, I would be sure that this would be dismissed. Now, I am not so sure, and that troubles me.