Fix Python – Unpacking a list / tuple of pairs into two lists / tuples

Possible Duplicate:
A Transpose/Unzip Function in Python

I have a list that looks like this:
list = ((‘1′,’a’),(‘2′,’b’),(‘3′,’c’),(‘4′,’d’))

I want to separate the list in 2 lists.
list1 = (‘1′,’2′,’3′,’4’)
list2 = (‘a’,’b’,’c’,’d’)

I can do it for example with:
list1 = []
list2 = []
for i in list:
list1.append(i[0])
list2.append(i[1]….

Fix Python – Ignore python multiple return value

Say I have a Python function that returns multiple values in a tuple:
def func():
return 1, 2

Is there a nice way to ignore one of the results rather than just assigning to a temporary variable? Say if I was only interested in the first value, is there a better way than this:
x, temp = func()

….

Fix Python – Why is there no tuple comprehension in Python?

As we all know, there’s list comprehension, like
[i for i in [1, 2, 3, 4]]

and there is dictionary comprehension, like
{i:j for i, j in {1: ‘a’, 2: ‘b’}.items()}

but
(i for i in (1, 2, 3))

will end up in a generator, not a tuple comprehension. Why is that?
My guess is that a tuple is immutable, but this does not seem to be the answer.
….

Fix Python – Expanding tuples into arguments

Is there a way to expand a Python tuple into a function – as actual parameters?
For example, here expand() does the magic:
some_tuple = (1, “foo”, “bar”)

def myfun(number, str1, str2):
return (number * 2, str1 + str2, str2 + str1)

myfun(expand(some_tuple)) # (2, “foobar”, “barfoo”)

I know one could define myfun as myfun((a, b, c)), but of c….