On 03/20/2011 10:11 PM, bearophile wrote:
Do you use tuple return values often, e.g. in Python?
Not in every line of code, but they are quite useful.
Tuples are useful for other purposes too, like:

for a,b in zip((1, 2, 3), "abc"):

Here a,b is a 2-tuple that Python automatically unpack from the result of the 
zip, that in Python2 is a list (array) of 2-tuples.

Typical example, I guess:

    for line in File("contacts.dat"):
        (name,phone,email) = line.split(';')
        # process name,phone,email

Denis
--
_________________
vita es estrany
spir.wikidot.com

Reply via email to