Ian Bicking: the old part of his blog

Re: Python nit, chapter 3

> Who among us has not accidentally passed in a string where a list is expected, then puzzled over the odd results that occur when the function thinks it has received a list of single-character values?

Me :)

I've been using Py for two years now - admittedly, not very long - but as far as I'm concerned it makes perfect sense to have strings an iterable container, and it's a nonsense to suggest otherwise.

As you mention, a string is a list of single character values, thus a string and a list are conceptually the same thing. While in all cases they may not be literally identical, for the most part they are and Python takes advantage of this by design.

Much of the Py code I author is responsible for data verifcation, and often involves iteration over a string sequence, so it's a feature I'd not happily lose, particularly when your argument stems from the fact that it simply makes programmer error more annoying.

Comment on Python nit, chapter 3
by Clay