2015-08-16 7:21 GMT-07:00 Paul Moore <p.f.mo...@gmail.com>:
> 2. By far and away the most common use for me would be things like
> print(f"Iteration {n}: Took {end-start) seconds"). At the moment I use
> str,format() for this, and it's annoyingly verbose. This would be a
> big win, and I'm +1 on the PEP for this specific reason.

You can use a temporary variable, it's not much longer:
   print("Iteration {n}: Took {dt) seconds".format(n=n, dt=end-start))
becomes
   dt = end - start
   print(f"Iteration {n}: Took {dt) seconds")

> 3. All of the complex examples look scary, but in practice I wouldn't
> write stuff like that - why would anyone do so unless they were being
> deliberately obscure?

I'm quite sure that users will write complex code in f-strings.

I vote -1 on the current PEP because of the support of Python code in
f-string, but +1 on a PEP without Python code.

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

Reply via email to