Why tuple with one item is no tuple

Batista, Facundo FBatista at uniFON.com.ar
Tue Mar 15 11:22:40 EST 2005


[Gregor Horvath]

#-  >>>type(('1'))
#- <type 'str'>
#- 
#- I wonder why ('1') is no tuple????

The parentheses don't create the tuple, the comma does:

>>> ('1')
'1'
>>> ('1',)
('1',)
>>> '1',
('1',)


.    Facundo

Bitácora De Vuelo: http://www.taniquetil.com.ar/plog
PyAr - Python Argentina: http://pyar.decode.com.ar/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050315/f0c177ac/attachment.html>


More information about the Python-list mailing list