Repository navigation
Immutable VersionInfo - #97
Conversation
|
I don't understand why CI is broken with pypy and Python 2.7. Any idea? |
|
CI fixed for Python 2.7 and PyPi |
| def build(self): | ||
| return self._build | ||
|
|
||
| def __setattr__(self, name, value): |
There was a problem hiding this comment.
I think this function is unnecessary
There was a problem hiding this comment.
I thought also that setattr wasn't necessary...
but not with Python 2.7 and Pypy
There was a problem hiding this comment.
Why do we want to have private attributes be mutable?
There was a problem hiding this comment.
You are right ...
This build shows that __setattr__ is not required.
Although what is required for Python 2.7 and Pypi is inheriting VersionInfo from object.
| assert str(v) == s_version | ||
|
|
||
|
|
||
| def test_immutable(): |
There was a problem hiding this comment.
Could you also add a test to check if it's possible to add new attribute? Something like this:
try:
v.some_attribute = 1
except:
...
| def build(self): | ||
| return self._build | ||
|
|
||
| def __setattr__(self, name, value): |
There was a problem hiding this comment.
Why do we want to have private attributes be mutable?
|
|
||
| def __setattr__(self, name, value): | ||
| if name not in self.__slots__: | ||
| raise AttributeError |
There was a problem hiding this comment.
Even if so, it's better to pass name to AttributeError to avoid any confusions.
Closes #96
Closes #96