On Dec 16, 2004, at 03:56, Marc Gartler wrote:
Hi everybody,
Prior to this chunk of code 'glass' has been chosen from a list of colors via user input, and I now want to have that choice connect to one of several possible classes:
def glass_type(glasstype): if glasstype == 'Red': myglass = RedGlassCost() elif glasstype == 'Blue': myglass = BlueGlassCost() elif glasstype == 'Yellow': myglass = YellowGlassCost() return myglass
glasschoice = glass_type(glass) myglass = glasschoice()
I've tried various approaches and keep getting different errors. But this one seems closest to my goal, as I know it is at least passing 'glass' into the function:
AttributeError: RedGlassCost instance has no __call__ method
What is this trying to tell me? Or is that irrelevant as I would be better off trying some other approach altogether?
Can we see your code for the *GlassCost classes?
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immortal machine?"
--
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting and sweating as you run through my corridors... How can you challenge a perfect, immortal machine?"
_______________________________________________ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor