Skip to content

Instantly share code, notes, and snippets.

@ramalho
Created November 22, 2013 17:33
Show Gist options
  • Select an option

  • Save ramalho/7603802 to your computer and use it in GitHub Desktop.

Select an option

Save ramalho/7603802 to your computer and use it in GitHub Desktop.
>>> class Coisa:
... __slots__ = ('tamanho', 'sabor')
...
>>> c = Coisa()
>>> c.tamanho
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: tamanho
>>> c.tamanho = 'G'
>>> c.tamanho
'G'
>>> c.peso = 7
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Coisa' object has no attribute 'peso'
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment