3 ms·
I frequently use code generation in python. why write thousands of lines of boilerplate code in any language when you can just generate it? Maybe I'm just lazy
by paulie_a 8y ago
I frequently use code generation in python. why write thousands of lines of boilerplate code in any language when you can just generate it? Maybe I'm just lazy but the results are better and more consistent to get something done.
- AstralStorm 8y agoWeird, typically you can use metaclasses or mixins to remove such boilerplate.
- paulie_a 8y agoI utilize that too but why not generate new models with forms, cbvs, drf endpoints, serializers, etc? You can pick and choose what you need, add the mixins and move on. Plus initial project using cookicutter to generate the original project in a much more fitting and featureful structure.
- andybak 8y agoI would regard anything other than tiny amounts of boilerplate to be a code smell in most languages. Code generation has so many downsides and Python is so dynamic I can't think what you're doing that couldn't be done better without code generation.