Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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