TP wrote:
[EMAIL PROTECTED] wrote:

a=("1","2")
b=[("3","4"),("5","6")]
list(a)+b
['1', '2', ('3', '4'), ('5', '6')]
a = ("1", "2")
b = [("3", "4"), ("5", "6")]
[a] + b
[('1', '2'), ('3', '4'), ('5', '6')]

Thanks a lot.
Why this difference of behavior between list(a) and [a]?

list(a) iterates through its argument, building a list from the results. In this case it iterates though the items in the tuple.

[a] just creates a list with a as an item.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to