On 04/11/2016 12:10 AM, Ben Finney wrote:

So, will we never get your statement of what surprised you between those
examples?

Clearly there is something of interest here. I'd like to know what the
facts of the matter were; “beginner's mind” is a precious resource, not
to be squandered.


I thought I had made the point clear with the REPL session below. I had (what 
seemed
to me like) a list of strings getting turned into a tuple. I was surprised that
a single string wasn't turned into a single-element tuple.
Now that I know that commas create tuples, but lack of commas don't, I'm not 
surprised anymore.

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

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to