[Python-ideas] strings as iterables - from str.startswith taking any iterator instead of just tuple

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Jan 3 05:27:15 CET 2014


On 03/01/2014 03:54, Alexander Heger wrote:
>
> Generally, I find strings being iterables of characters as useful as
> if integers were iterables of bits.  They should just be units.  They
> already start out being not mutable.  I think it would be a positive
> design change for Python 4 to make them units instead of being
> iterables.  At least for me, there is much fewer applications where
> the latter is useful than where it requires extra code.  Overall, it
> makes the language less clean that a string is an iterable; a special
> case we always have to code around.
>

I find your terminology misleading.  A string is a sequence in the same 
way that list, tuple, range, bytes, bytearray and memoryview are.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence



More information about the Python-ideas mailing list