by blasdel · 17y ago · 0 comments
THIS
Don't ever generate boilerplate Python code (especially 'fill in the blanks' crap). You're using a language where you can put the data in an appropriate structure used by high-order code.
You don't even have to make a new data structure if the information is already present. For instance, I wrote a python library that when called as an executable, looks up 'tool verb' style commands by looking at the methods on the available classes, gets the help from __doc__, and the extra optargs from attributes on the methods (added via a decorator).
So, help me out here - "You're using a language where you can put the data in an appropriate structure used by high-order code." I don't understand that statement? I don't know what "the data" or "high-order code" is?
It's true that in less powerful languages, you need code generation to do what more powerful languages can do with higher-order functions and reflection. But it's also true that code generation (along with other techniques from compiler and language development) remain quite useful for writing shorter, clearer programs in environments that support this.