Scott David Daniels skrev: > Sheldon wrote: > > Hi, > > > > I have a series of classes that are all within the same file. Each is > > called at different times by the main script. Now I have discovered > > that I need several variables returned to the main script. Simple, > > right? I thought so and simply returned the variables in a tuple: > > (a,b,c,d,e) = obj.method() > > Now I keep getting this error: "ValueError: unpack tuple of wrong size" > What you need to do at this point is read the _whole_ error message > (including the ugly traceback stuff). Think hard about what is going > on. "ValueError: unpack tuple of wrong size" comes from returning > a tuple of a different size than your assignment is producing: > > def triple(v): > return v, v*v > > x, y, z = triple(13) > > Break up the assignment and insert prints: > > # x, y, z = triple(13) > temp = triple(13) > print "I'm going to expand the triple:", temp > x, y, z = temp > > > > I think this is because I am trying to return some Numeric arrays as > > well as list and I didn't declare these prior to calling the class > > method. > Don't guess and hypothesize; create experiments and test. Your > reasoning is off in the ozone. You waste a lot of time creating > great theories; make tiny theories and _test_ them. > > <<and the theories wander farther and farther off into the weeds>> > > --Scott David Daniels > [EMAIL PROTECTED]
Thanks for sound advice! Will give it another go. /Sheldon -- http://mail.python.org/mailman/listinfo/python-list