> By designing an API that doesn't require such overloading.
> On Thursday, January 2, 2014, Alexander Heger wrote:
>> >> isinstance(x, Iterable) and not isinstance(x, str)
>> > If you find yourself typing that a lot I think you have a bigger problem
>> > though.
>> How do you replace this?
for my applications this seemed the most natural way - have the method
deal with what it is fed, which could be strings or any kind of
collections or iterables of strings. But never would I want to
disassemble strings into characters. From the previous message I
gather that I am not the only one with this application case.
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 know it will break a lot of existing code, but so did the string
change from py2 to 3. (It would break very few of my codes, though.)