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

Jamesie Pic jpic at yourlabs.org
Mon Jan 28 20:49:50 EST 2019


PS: sorry for my silly example, i know that example could also be written
f'cancel_{name}', which is awesome, thank you for that ! But for more
complex strings I'm trying to avoid:

def foo():
    return textwrap.dedent(f'''
    some
    {more(complex)}
    {st.ri("ng")}
    ''').strip()

For some reason, I prefer:

def foo():
    return '\n'.join(['some', more(complex), st.ri('ng')])

But that would be even more readable (less nesting of statements):

def foo():
    return ['some', more(complex), st.ri('ng')].join('\n')

Hope this makes sense

Have a great day
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190129/d75d4719/attachment.html>


More information about the Python-ideas mailing list