Python Macros: Use Cases?
问题 If Python had a macro facility similar to Lisp/Scheme (something like MetaPython), how would you use it? If you are a Lisp/Scheme programmer, what sorts of things do you use macros for (other than things that have a clear syntactic parallel in Python such as a while loop)? 回答1: Some examples of lisp macros: ITERATE which is a funny and extensible loop facility CL-YACC/FUCC that are parser generators that generate parsers at compile time CL-WHO which allows specifying html documents with