On 04/10/2016 08:13 PM, Fillmore wrote:
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')
>>>
Hold on a sec! it turns up that there is such thing as single-element tuples in
python:
>>> c = ('hello',)
>>> c
('hello',)
>>> c[0]
'hello'
>>> c[1]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: tuple index out of range
>>>
So, my original question makes sense. Why was a discontinuation point
introduced by the language designer?
--
https://mail.python.org/mailman/listinfo/python-list