On Dec 16, 2004, at 04:20, Max Noel wrote:
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()
Can we see your code for the *GlassCost classes?
Nevermind, I just figured out the problem. RedGlassCost() returns an instance of the RedGlassCost class, whereas RedGlassCost is the class itself. Thus, you need to remove the parentheses either in the def_glasstype function (you then return a class, affect it to glasschoice and then create an instance of it by instanciating glasschoice) or in your last line (glass_type returns an instance of the class you want).
-- Max
_______________________________________________ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor