Created
August 29, 2019 07:31
-
-
Save r4inm4ker/4c18dc22019dd1fdc129b7b1b1bba3a9 to your computer and use it in GitHub Desktop.
dynamic return func
This file contains 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(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