Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Cool use of eval. I wonder if there are metaprogramming aimed libraries for generating eval'd code.


Why would you want that when you have actual metaprogramming on code-as-data in the standard library?


Is this a joke on the namedtuple trick or is there actually such a module in the standard library?


Not 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.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: