Skip to content

Instantly share code, notes, and snippets.

@taddeimania
Last active August 29, 2015 14:14
Show Gist options
  • Save taddeimania/328d6154af1fb49ba95b to your computer and use it in GitHub Desktop.
Save taddeimania/328d6154af1fb49ba95b to your computer and use it in GitHub Desktop.
# 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'
}
@taddeimania
Copy link
Author

Thanks for clearing that up. I've seen a @class_property decorator in pytool for accessing the property on the class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment