Paul Rubin wrote:
Ethan Furman <et...@stoneleaf.us> writes:

some_list = [1, 2]
this, that = func(alist)

At least, in 2.5.4 this works.  :-)


But that fails if there are fewer than two elements in the list.  It's
better to just make the logic either expect a list, or if it's
implementing something like an optional value, code it up explicitly.
You may even want to return two lists, the second one possibly empty.

It also fails if there are more than two elements in the list, as the rest of my post went on to say. I myself would generally not use such a structure, but that doesn't mean the OP doesn't have a good use case for it. Don't forget, his original question indicated that there could be more than two return elements also.

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to