osdir.com


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

Pylint false positives


On Mon, 20 Aug 2018 22:55:26 +0300, Marko Rauhamaa wrote:

> Dan Sommers <dan at tombstonezero.net>:
> 
>> On Mon, 20 Aug 2018 14:39:38 +0000, Steven D'Aprano wrote:
>>> I have often wished Python had proper namespaces, so I didn't have to
>>> abuse classes as containers in this way :-(
>>> 
>>> (Not that I do this using "inner classes", but I do often want to use
>>> a class as a container for functions, without caring about "self" or
>>> wrapping everything in staticmethod.)
>>
>> Isn't that what modules are for?  (I suspect that I'm missing something,
>> because I also suspect that you knew/know that.)
> 
> What's the syntax for creating an inner module...?

Why does it have to be an inner anything?  An ordinary, top-level,
"outer" module is a perfectly good "container for functions, without
caring about "self.""  The Python "math" module, for example.  As a long
time, non-native speaker of Object Oriented, I must admit that I still
don't understand the obsession with classes (a certain level of
usefulness and arguably appropriateness for some kinds of problems,
sure, but not the obsession).

Dan