Skip to content

Instantly share code, notes, and snippets.

@satishgoda
Forked from r4inm4ker/dyn_return_func.py
Created August 29, 2019 08:03
Show Gist options
  • Save satishgoda/6139a9d3c0fb76687b4bb837c7ec7328 to your computer and use it in GitHub Desktop.
Save satishgoda/6139a9d3c0fb76687b4bb837c7ec7328 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