On 23/02/2020 18:33, Steve Jorgensen wrote:
In many ways, a string is more useful to treat as a scalar than a collection, 
so drilling down into collections and ending up iterating individual characters 
as the leaves is often 1 step too far.

I think the key word here should be "sometimes". A lot of the time I do treat strings as scalars (or more often, string.split() as a sequence of scalars), but sometimes a string absolutely is a sequence of characters, and I want to be able to treat it as such.

I have to admit that most of the time that I end up in trouble because of unexpectedly iterating through a string, it's my own stupid fault. Almost always I have been doing something over simplistic or wrong-headed, usually returning a string from a function when I meant to return a list of (one) string(s) instead.

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/QHL5C4BE24XSPINP5WUMDBT432K3IQQY/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to