Scenario: you have a long tuple as a result of a SQL query and want to unpack it into individual values. What's the best way to do that while conforming to PEP8? So far I have these three options:
single assignment, use backslash to split to multiple lines
person_id, first_name, last_name, email, \ birth_date, graduation_year, home_street, \ home_city, home_zip, mail_street, mail_city, \ mail_zip = rowsingle assignment, group left-hand side in parantheses and break lines without a backslash
(person_id, first_name, last_name, email, birth_date, graduation_year, home_street, home_city, home_zip, mail_street, mail_city, mail_zip) = rowsplit into multiple assignments, each fitting into a single line
person_id, first_name, last_name, email = row[0:4] birth_date, graduation_year, home_street = row[4:7] home_city, home_zip, mail_street, mail_city = row[7:11] mail_zip = row[11]
Which of the three options is the best? Is there anything better?
namedtupleinstead of separate names? - jonrsharpe