Am I doing something non-pythonic here? Or is it a pylint error?
class Thing(object):
"""
Thing used for stackoverflow example.
"""
def __init__(self, something):
"""
Initialize Thing.
"""
self._something = None
self.something = something
@property
def something(self):
"""
Get something
"""
return self._something
@something.setter
def something(self, value):
"""
Set something.
"""
self._something = value
I got the impression that using property decorators was a smart way to implement properties. Pilint says otherwise. Pylint gives me the following errors:
Thing: Too many instance attributes (2/1)
Thing.something: An attribute affected in thing line 10 hide this method
If I implement the property in the old way, I do not get the same problem.
class Thing(object):
"""
Thing used for stackoverflow example.
"""
def __init__(self, something):
"""
Initialize Thing.
"""
self._something = None
self.set_something(something)
def get_something(self):
"""
Get something
"""
return self._something
def set_something(self, value):
"""
Set something.
"""
self._something = value
something = property(get_something, set_something)
source
share