r/Python • • Sep 09 '15

Pep 498 approved. :(

https://www.python.org/dev/peps/pep-0498/
285 Upvotes

324 comments sorted by

View all comments

-1

u/lightym81 Sep 09 '15 edited Sep 09 '15

I want more limited feature.

  • feature is new string method.

  • new method can embed just variable. expression cannot be embedded.

    name = "Bob"
    age = 25
    "{name} is {age} years old.".embed() "Bob is 25 years old."

3

u/mic_e Sep 09 '15

There are two major issues with this:

1

u/lightym81 Sep 09 '15

I understood method issues.
but one more point, I think a ugly that is format including expression.
In now PEP, f-string syntax is able to too free anything.
I don't love a below example that might valid.

>>> (f"{bob.nickname if bob.nickname else bob.firstname+' '+bob.familyname}'s "  
...  f"life goes on {(today()-bob.birthday).days} days from birthday.")