Skip to content

Instantly share code, notes, and snippets.

@SirEdvin
Created April 17, 2018 16:07
Show Gist options
  • Save SirEdvin/66e4dd46be4b01a89ca93d3f791343f7 to your computer and use it in GitHub Desktop.
Save SirEdvin/66e4dd46be4b01a89ca93d3f791343f7 to your computer and use it in GitHub Desktop.
class C1:
def __init__(self, obj):
self.obj = obj
def __getattr__(self, name):
if hasattr(self.obj, name):
return getattr(self.obj, name)
def t1(self):
print(5)
class A:
def t2(self):
print(4)
def t1(self):
print(7)
c = C1(A())
c.t1()
c.t2() # Откуда бы линтеру знать, что у C1 есть метод t2?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment