On 2015-08-10 2:37 PM, Eric V. Smith wrote:
Besides, any expression you have to calculate can go in a local that will get
>interpolated.  The same goes for any !r or other formatting modifiers.  In an
>i18n context, you want to stick to the simplest possible substitution
>placeholders.
This is why I think PEP-498 isn't the solution for i18n. I'd really like
to be able to say, in a debugging context:

print('a:{self.a} b:{self.b} c:{self.c} d:{self.d}')

without having to create locals to hold these 4 values.

Why can't we restrict expressions in f-strings to
attribute/item getters?

I.e. allow f'{foo.bar.baz}' and f'{self.foo["bar"]}' but
disallow f'{foo.bar(baz=something)}'

Yury
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to