Created
August 13, 2018 13:03
-
-
Save mgedmin/2b5a31278fea1014d1122301fac0e77a to your computer and use it in GitHub Desktop.
This file contains 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
Python 2.7.14 (default, Sep 23 2017, 22:06:14) | |
[GCC 7.2.0] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> class Wat(object): | |
... __slots__ = ('a', 'b') | |
... a = 42 | |
... | |
>>> x = Wat() | |
>>> x.a | |
42 | |
>>> x.b | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
AttributeError: b | |
>>> Wat.a | |
42 | |
>>> Wat.b | |
<member 'b' of 'Wat' objects> | |
>>> type(Wat.b) | |
<type 'member_descriptor'> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment