Skip to content

Instantly share code, notes, and snippets.

@Jae-Myeong
Created April 7, 2012 15:57
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 Jae-Myeong/2329923 to your computer and use it in GitHub Desktop.
Save Jae-Myeong/2329923 to your computer and use it in GitHub Desktop.
usage of python property
class Silly:
@property
def silly(self)
print("You are getting silly")
return self._silly
@silly.setter
def silly(self, value):
print("You are making silly {}".format(value))
self._silly = value
@silly.deleter
def silly(self):
print("Whoa, you killed silly!")
def self._silly
mySilly = Silly()
mySilly.silly = "I'm calling getter"
print(mySilly.silly)
del mySilly.silly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment