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

(and so on).  Is there a cleaner way to accomplish the same thing?

return tuple(result)

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.

JM
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to