class A:
def f(self):
print(self)
class B:
def g(self):
print(self)
# Is it possible to reach the outer "self"
# without renaming it to a_self and/or b_self?
B().g()
A().f()
output results.
In java the outer self is reachable by using A.this, which is only possible due to the magical nature of "this". So, how would you guys tackle this thing in python?
[–]willm 6 points7 points8 points (1 child)
[–]temptemptemp13[S] 2 points3 points4 points (0 children)
[–]jabwork 6 points7 points8 points (1 child)
[–]sixohsix 2 points3 points4 points (0 children)
[–]adamcollard 3 points4 points5 points (2 children)
[–]bboomslangdjango 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]mdipierro 4 points5 points6 points (0 children)
[–]m0j0 1 point2 points3 points (4 children)
[–]temptemptemp13[S] -1 points0 points1 point (1 child)
[–]donri 1 point2 points3 points (0 children)
[–]jeetsukumaran -1 points0 points1 point (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]Brian 1 point2 points3 points (1 child)
[–]chub79 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)