Last active
January 4, 2016 08:33
-
-
Save vladyio/ec59ef6c407c25a13c7a 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
class Hij: | |
attr = 1 | |
hij_var = Hij() | |
hij_var.attr = 2 | |
hij_var.__dict__ # => {'attr': 2} | |
############################################################################### | |
class Abc: | |
__slots__ = ["some_attr"] | |
alpha = Abc() | |
alpha.some_attr = 1 | |
alpha.some_attr # => 1 | |
alpha.other_attr # => AttributeError: 'Abc' object has no attribute 'other' | |
alpha.__dict__ # => AttributeError: 'Abc' object has no attribute '__dict__' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment