indentation messing up my tuple?

infidel saint.infidel at gmail.com
Wed Feb 1 15:38:26 EST 2006


> i am using a tuple because i am building lists.

I don't understand

> if i just use (food +
> drink) then while drink is unique food remains the same do i get this:
>
> (burger, coke)
> (burger, 7up)
> (burger, sprite)

I don't understand what you're saying here.


food and drink are both strings.  adding them together gives you a new
string.  putting parentheses around a string does not give you a tuple,
you need that magic comma to get python to recognize the expression as
a tuple.

As I said:

> > (food + drink + '\n') is not a tuple, (food + drink + '\n',) is


And since all you're doing with the data list is joining into a single
string, I still don't see where you need any tuples.




More information about the Python-list mailing list