[Tutor] Using type
alan.gauld at btinternet.com
Fri Aug 12 11:31:54 CEST 2011
> It'll work on lists and tuples, for simple examples. But beware that
> when you iterate through strings, the individual characters are also
> strings, and this function will fail with an error like:
> RuntimeError: maximum recursion depth exceeded
Oh, good catch Dave.
So you'd want to add an explicit check for a string.
And in fact you probably don't want to "flatten" a string into
individual characters anyway!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor