Christopher Barker wrote: > I think that the "strings are an iterable of strings", i.e. an iterable of > iterables onto infinity... is the last remaining common dynamic type issue > with Python. > However, I'd like to see the "solution" be a character type, rather than > making strings not iterable, so iterating a string would yield chars, and > chars would not be strings themselves, and not be iterable (or a sequence > at all). > This would be analogous to other iterables -- they can contain iterables, > but if you keep iterating (or indexing), eventually you get to a "scalar", > non iterable value.
I get what you're saying, and I don't categorically disagree, but… 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 either making strings not (directly) iterable or making them iterables of chars (that are not strings) would be a step in the right direction. Of those 2 ideas, I slightly prefer the option making strings effectively scalar. _______________________________________________ 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/CC5L3CDRLEYYCNMR43E2DVHBY7GUC3QY/ Code of Conduct: http://python.org/psf/codeofconduct/