3 ms·
Cool use of eval. I wonder if there are metaprogramming aimed libraries for generating eval'd code.
by fulafel 9y ago
Cool use of eval. I wonder if there are metaprogramming aimed libraries for generating eval'd code.
- nerdponx 9y agoWhy would you want that when you have actual metaprogramming on code-as-data in the standard library?
- fulafel 9y agoIs this a joke on the namedtuple trick or is there actually such a module in the standard library?
- nerdponx 9y agoNot a joke, but "code as data" was hyperbolic. You can do some pretty amazing metaprogramming in Python with metaclasses, and the inspect and ast modules give you access to the guts of the language.