Skip to content

Instantly share code, notes, and snippets.

@mgedmin
Created August 13, 2018 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgedmin/2b5a31278fea1014d1122301fac0e77a to your computer and use it in GitHub Desktop.
Save mgedmin/2b5a31278fea1014d1122301fac0e77a to your computer and use it in GitHub Desktop.
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