[Python-ideas] Add list.join() please
mertz at gnosis.cx
Tue Jan 29 22:51:01 EST 2019
The point really is that something called 'stringify()' could do a lot of
different reasonable and useful things. None of them are universally what
users would want. Unless you have to function scads if optional keyword
arguments, is behavior would surprise many users and not for their purpose.
On Tue, Jan 29, 2019, 10:46 PM David Mertz <mertz at gnosis.cx wrote:
> 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 at gmail.com
>> 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 :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas