All pastes #967733 Raw Edit

Something

public text v1 · immutable
·published 2008-04-02 16:43 UTC
rendered paste body
class Factory:
    def __init__(self, name):        
        if not name:
            print "Name is not set, please provide type"
        else:
            self.name=name             
            print "All looks good so far - trying to create class." +  self.name  
            try:
             __import__(name); 
            
            # return name()
                                               
            except Exception,e:
                print "Cannot instantiate proper subclass - Class : %s"%e

==== invocation
li=['A','B','C']
chosen=li[0]
o=Factory(chosen) 
print o.name