one-element tuples [Was: Most probably a stupid question, but I still want to ask]

Fillmore fillmore_remove at hotmail.com
Sun Apr 10 20:13:21 EDT 2016


Sorry guys. It was not my intention to piss off anyone...just trying to understand how the languare works

I guess that the answer to my question is: there is no such thing as a one-element tuple,
and Python will automatically convert a one-element tuple to a string... hence the
behavior I observed is explained...

 >>> a = ('hello','bonjour')
 >>> b = ('hello')
 >>> b
'hello'
 >>> a
('hello', 'bonjour')
 >>>


Did I get this right this time?




More information about the Python-list mailing list