4 ms·
Strings being it stable can cause problems, and another commenter has pointed out that Swift handles it well. However I think strings being iterable is one of
by danpalmer 6y ago
Strings being it stable can cause problems, and another commenter has pointed out that Swift handles it well.
However I think strings being iterable is one of the core ergonomics in the language and basic types of Python that make it so nice for many applications. Scripting, scraping, data cleanup, data science, even basic web development, all benefit hugely from little features like this. Without this sort of thing Python would be a different language with different uses.
While I normally like safety and types, I’m personally happy with things like this because it fits with Pythons strengths.
- cauthon 6y agoI disagree, I don’t think there’s any meaningful benefit. For example, lets say we iterated over strings as follows. for char in my_str.chars(): foo() That wouldn’t sacrifice any ergonomics, being consistent with how we already iterate over dictionary contents with d.items(), and it’d address all the concerns in the parent comment link