Pass a class to an InteractiveCompiler?

Michael Jard faust at wintermarket.org
Mon Aug 30 08:12:30 EDT 2004


class grid_object:
    def __init__(self,object_class=""):
        import random
        import code
        self.id = random.randrange(1,99999)
        self.object_class = object_class
        self.label = "grid object: %s %i" % (self.object_class, self.id)
        self.vector = [0,0,0]
        source = open(grid_config.object_scripts + self.object_class,'r')

        x = code.InteractiveConsole({'grid_object':self})

        for line in source:
            x.push(line)


I'd like to think that was possible?




More information about the Python-list mailing list