Gregor Horvath wrote:
Hi,

 >>>type(['1'])
<type 'list'>

 >>>type(('1'))
<type 'str'>

I wonder why ('1') is no tuple????

Because I have to treat this "special" case differently in my code.

you need to tell python that ('1') isn't a string inside a couple parens but a tuple, look:

>>> t = ('1', )
>>> type(t)
<type 'tuple'>

if there's no ambiguity you can omit the parens:

>>> t = '1',
>>> type(t)
<type 'tuple'>

HTH,
deelan

--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:nick "deelan" ;
foaf:weblog <http://blog.deelan.com/> .
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to