Is there a better way to code variable number of return arguments?

Paul Rubin http
Thu Oct 8 18:43:43 CEST 2009

"Dr. Phillip M. Feldman" <pfeldman at> writes:
> if len(result)==1: return result[0]
> if len(result)==2: return result[0], result[1]
> (and so on).  Is there a cleaner way to accomplish the same thing?

That is poor style.  Just return the result as a list.

More information about the Python-list mailing list