Pylint false positives

Chris Angelico rosuav at gmail.com
Fri Aug 17 08:40:23 EDT 2018


On Fri, Aug 17, 2018 at 9:49 PM, Jon Ribbens <jon+usenet at 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



More information about the Python-list mailing list