Created
January 1, 2019 21:02
-
-
Save vesche/4c9f9e0a7fd508dd29be202310196d55 to your computer and use it in GitHub Desktop.
Nested attributes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A: | |
def __init__(self): | |
self.b = B() | |
@property | |
def f1(self): | |
return self.b | |
class B: | |
def __init__(self): | |
self.c = C() | |
@property | |
def f2(self): | |
return self.c | |
class C: | |
@property | |
def f3(self): | |
return ':D' | |
a = A() | |
print(a.f1.f2.f3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment