Created
October 11, 2016 13:19
-
-
Save rectalogic/1450095191acbf4488cd048fa5dea3b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> class Foo(object): | |
... __slots__ = ("e",) | |
... e = None | |
... | |
>>> f = Foo() | |
>>> f.e = "x" | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
AttributeError: 'Foo' object attribute 'e' is read-only | |
>>> f.e | |
>>> class Foo(object): | |
... e = None | |
... | |
>>> f = Foo() | |
>>> f.e | |
>>> f.e = "X" | |
>>> f.e | |
'X' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment