one-element tuples
Ben Finney
ben+python at benfinney.id.au
Sun Apr 10 20:56:25 EDT 2016
Fillmore <fillmore_remove at hotmail.com> writes:
> 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.
What behaviour did you expect instead? That's still unclear.
Can you show the fictional session that would result from the behaviour
you expect?
--
\ “Education is learning what you didn't even know you didn't |
`\ know.” —Daniel J. Boorstin, historian, 1914–2004 |
_o__) |
Ben Finney
More information about the Python-list
mailing list