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
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to