[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pylint false positives

On Sun, Aug 19, 2018 at 7:11 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Chris Angelico <rosuav at gmail.com>:
>> Your acceptance of closures is a perfect proof of how magic stops
>> looking like magic once you get accustomed to it.
> Actually, that's a very good observation. You should stick with a
> smallish kernel of primitives and derive the universe from them.
> Anyway, functions as first-class objects are truly foundational in all
> high-level programming. In Python programming, I mostly run into
> closures through inner classes (as in Java).
>> If you can accept closures because they just DTRT, why not accept a
>> much simpler and more obvious operation like putting a 'def' statement
>> in a loop?
> Nothing wrong or extraordinary with putting a def statement in a loop,
> but populating an object with fields (methods) in a loop is very rarely
> a good idea.


So this is okay:

def f():
    for i in range(5):
        def g(): ...

But this isn't:

class C:
    for i in range(5):
        def m(self): ...

I've missed something here.