Of course not! The request was for something that worked on Python *collections*. If the OP wanted something that worked on iterables in general, we'd need a different function with different behavior.

Of course, it also doesn't work on dictionaries. I don't really have any ideas what the desired behavior might be for dicts. Various things are conceivable, none obvious. But it's fine on lists, sets, tuples, deques, and some other things that are roughly sequence-like.



On Tue, Jan 29, 2019, 10:38 PM Robert Vanden Eynde <robertve92@gmail.com wrote:

stringify = lambda it: type(it)(map(str, it))

stringify(range(5)) doesn't work ^^

One advantage or having a standard function is that it has been designed by a lot of persons for all possible use cases :)