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

Pylint false positives

Steven D'Aprano <steve+comp.lang.python at pearwood.info>:

> On Sun, 19 Aug 2018 00:11:30 +0300, Marko Rauhamaa wrote:
>> In Python programming, I mostly run into closures through inner classes
>> (as in Java).
> Inner classes aren't closures.

At least some of the methods of inner classes are closures (or there
would be no point to an inner class).

> Its also quite expensive to be populating your application with lots
> of classes used only once each, which is a common pitfall when using
> inner classes. Memory is cheap, but it's not so cheap that we ought to
> just profligately waste it needlessly.

That is a completely separate question.

There's is no a-priori reason for inner classes to be wasteful; they
have been part and parcel of Java programming from its early days, and
Java is widely used for high-performance applications.

CPython does use memory quite liberally. I don't mind that as
expressivity beats performance in 99% of programming tasks.

>> populating an object with fields (methods) in a loop is very rarely a
>> good idea.
> Of course it is *rarely* a good idea

So no dispute then.