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

Dr. Phillip M. Feldman pfeldman at verizon.net
Thu Oct 8 12:41:31 EDT 2009


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[0]
if len(result)==2: return result[0], result[1]

(and so on).  Is there a cleaner way to accomplish the same thing?
-- 
View this message in context: http://www.nabble.com/Is-there-a-better-way-to-code-variable-number-of-return-arguments--tp25803294p25803294.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list