one-element tuples

Fillmore fillmore_remove at hotmail.com
Sun Apr 10 20:48:35 EDT 2016


On 04/10/2016 08:31 PM, Ben Finney wrote:
> Can you describe explicitly what that “discontinuation point” is? I'm
> not seeing it.

Here you go:

 >>> a = '"string1"'
 >>> b = '"string1","string2"'
 >>> c = '"string1","string2","string3"'
 >>> ea = eval(a)
 >>> eb = eval(b)
 >>> ec = eval(c)
 >>> type(ea)
<class 'str'>   <--- HERE !!!!
 >>> type(eb)
<class 'tuple'>
 >>> type(ec)
<class 'tuple'>

I can tell you that it exists because it bit me in the butt today...

and mind you, I am not saying that this is wrong. I'm just saying that it surprised me.






More information about the Python-list mailing list