Skip to content

Instantly share code, notes, and snippets.

@moorepants
Created August 16, 2012 18:25
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 moorepants/3372384 to your computer and use it in GitHub Desktop.
Save moorepants/3372384 to your computer and use it in GitHub Desktop.
read only property
class MainClass(object):
@property
def name(self):
if self.__class__ is MainClass:
return name
else:
#dont return, give error or warning
raise StandardError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment