Good style for multi-valued returns

Will Ware wware at world.std.com
Thu Apr 20 16:03:24 EDT 2000


Cameron Laird (claird at starbase.neosoft.com) wrote:
> Let me guess:  folks generally pass tuples for small and
> determinate-in-number multi-values

Yup, this is what I've always seen others do, and done myself.
This makes it easy to take advantage of tuple-wise assignments
from return values, e.g.:

	x, y, z = multiValuedFunction(arg1, arg2)

The dictionaries-for-larger-cases idea sounds good, but it almost
sounds like you're solving a different problem. My inexperienced
guess is that tuples would offer better performance than dictionaries,
but a 62-element tuple wouldn't be particularly self-documenting.
-- 
 - - - - - - - - - - - - - - - - - - - - - - - -
Resistance is futile. Capacitance is efficacious.
Will Ware	email:    wware @ world.std.com



More information about the Python-list mailing list