Last active
August 29, 2015 14:14
-
-
Save taddeimania/328d6154af1fb49ba95b 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
# aside from the dict being vulnerable to overwrite what benefit does the @property give | |
# over the dict on the instance in this particular use case? | |
class MyClass(object): | |
@property | |
def my_attribute(self): | |
return { | |
'key': 'value' | |
} | |
my_dictionary = { | |
'key': 'value' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for clearing that up. I've seen a @class_property decorator in pytool for accessing the property on the class.