I didn't even realize f'{n for n in row}' was already valid syntax. Since 
generator expressions can usually only appear within parentheses, I assumed the 
syntax wouldn't conflict with anything because you would need to parenthesize 
the generator to make it work. Anyway, now I see that the better option is to 
leave the interpolation as-is but introduce a conversion flag that can unroll 
any iterable, so the current behavior actually works in our favor here. This 
would indeed be more powerful than any specialized comprehension syntax.

    print(''.join(f'{n:>8.3f}' for n in row) + f' | {sum(row):>8.3f}')
    print(f'{row!u:>8.3f} | {sum(row):>8.3f}')

Now the second option is even more attractive in my opinion. I'm using !u for 
"unroll". The good news is that implementing a conversion flag is a much less 
intrusive change.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/YBTB5WMSBZQPCIUPPMRLTYITPSSRPQRK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to