Skip to content

Instantly share code, notes, and snippets.

@bsmithyman
Created November 9, 2015 15:49
Show Gist options
  • Save bsmithyman/b911458fe780f146d403 to your computer and use it in GitHub Desktop.
Save bsmithyman/b911458fe780f146d403 to your computer and use it in GitHub Desktop.
class Blorgle(object):
@property
def incompatible(self):
import inspect
frame = inspect.currentframe()
print('Current')
print(frame.f_locals.get('self', None))
print('Previous')
print(frame.f_back.f_locals.get('self', None))
print('2Prev')
print(frame.f_back.f_back.f_locals.get('self', None))
print('3Prev')
print(frame.f_back.f_back.f_back.f_locals.get('self', None))
def checkCaller(self):
return self.incompatible
class Florgle(object):
def callOther(self, other):
return other.checkCaller()
a = Blorgle()
b = Florgle()
b.callOther(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment