Is there a better way to code variable number of return arguments?
jeanmichel at sequans.com
Thu Oct 8 18:55:39 CEST 2009
Dr. Phillip M. Feldman wrote:
> I currently have a function that uses a list internally but then returns the
> list items as separate return
> values as follows:
> if len(result)==1: return result
> if len(result)==2: return result, result
> (and so on). Is there a cleaner way to accomplish the same thing?
But you down want to do that, cause the caller will have a hell of a job
getting your result. You may want to simply return the list itself.
More information about the Python-list