[Python-ideas] Add list.join() please

Robert Vanden Eynde robertve92 at gmail.com
Wed Jan 30 01:13:33 EST 2019

> def stringify(*args, *, sep:str=SomeDefault):
I meant def stringify(*args, sep:str=SomeDefault)

So an idea would use duck typing to find out if we have 1 iterable or a
multiple stuff :

def stringify(*args, sep:str=SomeDefault, fmt=''):
    it = args[0] if len(args) == 1 and hasattr(args[0], '__iter__') else
    return sep.join(format(x, fmt) for x in it)

But 🦆 duck typing is nasty... I don't want that in the stdlib (but in a
pip package, sure!)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190130/defc6041/attachment.html>

More information about the Python-ideas mailing list