On Fri, Aug 17, 2018 at 9:49 PM, Jon Ribbens <jon+use...@unequivocal.eu> wrote: >> "Code running directly under the class" describes every use of the class >> keyword (except those with an empty body). If you write: >> >> class Spam: >> x = 1 >> >> you are running code under the class. This is not just a pedantic >> technicality, > > Yes, it absolutely is, in this context. Having code other than > assignments and function definitions under the class statement > is extremely rare.
Programming is heavily about avoiding duplicated work. Creating methods is work. Creating many identical (or similar) methods is duplicated work. What's wrong with using a loop to create functions? ChrisA -- https://mail.python.org/mailman/listinfo/python-list