Le lundi 10 août 2015, Eric V. Smith <eric at 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150811/a5265fe6/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4