Le lundi 10 août 2015, Eric V. Smith <e...@trueblade.com> a écrit :
> On 08/10/2015 10:18 AM, Victor Stinner wrote: > > Hi, > > > > I read the PEP but I don't understand how it is implemented. For me, it > > should be a simple preprocessor: > > > > - f'x={x}' is replaced with 'x={0}'.format(x) by the compiler > > - f'x={1+1}' is replaced with 'x={0}'.format(1+1) > > - f'x={foo()!r}' is replaced with 'x={0!r}'.format(foo()) > > - ... > > > > That's all. No new language, no new function or method. > > There is no new function or method being proposed. The "pre-processor" > is being implemented as the ast is being built. As the PEP says, though, > the expressions supported aren't exactly the same, so a simple > conversion to str.format syntax isn't possible. > Can you please provide example(s) of f-string(s) which cannot be replaced by a call to .format() like I did? Victor
_______________________________________________ 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