I am puzzled by the reason for this difference between lists and tuples.
A list of with multiple strings can be reduced to a list with one string with the expected results:
for n in ['first','second']:
print n
for n in ['first']:
print n
The first loop prints "first", "second", and the second prints "first".
====
This is not true for a tuple:
for n in ('first','second'):
print n
for n in ('first'):
print n
prints "first", "second" in the first case, but "f","i","r","s","t" in the second.
Where is this inconsistency explained?
--
https://mail.python.org/mailman/listinfo/python-list
A list of with multiple strings can be reduced to a list with one string with the expected results:
for n in ['first','second']:
print n
for n in ['first']:
print n
The first loop prints "first", "second", and the second prints "first".
====
This is not true for a tuple:
for n in ('first','second'):
print n
for n in ('first'):
print n
prints "first", "second" in the first case, but "f","i","r","s","t" in the second.
Where is this inconsistency explained?
--
https://mail.python.org/mailman/listinfo/python-list