On Sat, 18 Aug 2018 00:33:26 +0300, Marko Rauhamaa wrote: > Chris Angelico <ros...@gmail.com>: >> Programming is heavily about avoiding duplicated work. > > That is one aspect, but overcondensing and overabstracting programming > logic usually makes code less obvious to its maintainer.
That may very well be true, but we're not talking about those evils here. We're talking about a simple factory technique for creating a number of identical objects in a loop. [...] > I would guess such techniques could come in handy in some framework > development but virtually never in ordinary application development. In > a word, steer clear of metaprogramming. Depending on your definition of metaprogramming, either: (1) this either isn't metaprogramming at all, merely programming and no more scary than populating a dict at runtime; or (2) if you mean what you say, that means no decorators, no closures, no introspection ("reflection" in Java terms), no metaclasses (other than type), no use of descriptors (other than the built-in ones), no template- based programming, no source-code generators. No namedtuples, Enums, or data-classes. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list