Skip to content

Instantly share code, notes, and snippets.

@yuuichi-fujioka
Created February 25, 2014 06:42
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 yuuichi-fujioka/9203946 to your computer and use it in GitHub Desktop.
Save yuuichi-fujioka/9203946 to your computer and use it in GitHub Desktop.
property example
class Foo():
def __init__(self):
self.meta = {}
@property
def name(self):
return self.meta.get('name', None)
@name.setter
def name(self, value):
self.meta['name'] = value
@name.deleter
def name(self):
if 'name' in self.meta:
del self.meta['name']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment