Skip to content

Instantly share code, notes, and snippets.

@r4inm4ker
Created August 29, 2019 07:31
Show Gist options
  • Save r4inm4ker/4c18dc22019dd1fdc129b7b1b1bba3a9 to your computer and use it in GitHub Desktop.
Save r4inm4ker/4c18dc22019dd1fdc129b7b1b1bba3a9 to your computer and use it in GitHub Desktop.
dynamic return func
class A(object):
def __init__(self):
self.var1 = None
self.var2 = None
class B(object):
def __init__(self):
self.var3 = None
self.var4 = None
def factory(myCls,*args,**kwargs):
return myCls(*args,**kwargs)
obj = factory(A)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment