Skip to content

Instantly share code, notes, and snippets.

@aflag
Last active January 17, 2016 17:09
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 aflag/2a04378053f79ec8d3ef to your computer and use it in GitHub Desktop.
Save aflag/2a04378053f79ec8d3ef to your computer and use it in GitHub Desktop.
class Foo(object):
def __init__(self):
self._x = 0
@property
def x(self):
return 1 / self._x
try:
if hasattr(Foo(), 'x'):
print('Yes!')
else:
print('No!')
except:
print('wat?')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment