[code-quality] __all__ defined inside a class
Alexander Todorov
atodorov at mrsenko.com
Thu Mar 22 17:23:37 EDT 2018
Hi folks,
I've just noticed that a legacy piece of code I'm working with contains the
following pattern:
class SomeClass(object):
__all__ = ['add', 'delete']
def __init__(self):
pass
def get(self):
pass
def add(self, x):
pass
def delete(self, x):
pass
And the caller of this class actually uses the .get() method. I have this in at
least 10 different places.
I wasn't able to find any information about __all__ having any special meaning
when defined inside a class so this looks like a mistake.
Q1: Do we want pylint to warn about __all__ being detected not at module level ?
Q2: Do we want another check to warn about class attributes staring with
single/double underscore ?
--
Alex
More information about the code-quality
mailing list