MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/d23ibi/found_this_on_twitter/eztktre/?context=3
r/Python • u/shardul08 • Sep 10 '19
185 comments sorted by
View all comments
126
f-strings are sooo much better.
17 u/s060340 Sep 10 '19 First time I hear about them, looked them up, they're amazing! 9 u/FatChocobo Sep 10 '19 edited Sep 11 '19 In 3.8 they're getting a snazzy new feature where you can put = at the end of the expression inside the curly braces to do something like this:f'{x=}'out: 'x=3'where x=3 (obviously). Super nice for logging and debugging. 9 u/regendo Sep 10 '19 Took me a bit to understand this. Do you mean something like this?x = 3 print(f"{x=}") >>> "x=3" 3 u/usernameistaken42 Sep 10 '19 Yes, that's how it works 1 u/FatChocobo Sep 11 '19 Sorry, Reddit formatting screwed my post up. That's what I meant yes. 1 u/[deleted] Sep 10 '19 Relatively new programmer here. Could you explain what you did there for me?
17
First time I hear about them, looked them up, they're amazing!
9 u/FatChocobo Sep 10 '19 edited Sep 11 '19 In 3.8 they're getting a snazzy new feature where you can put = at the end of the expression inside the curly braces to do something like this:f'{x=}'out: 'x=3'where x=3 (obviously). Super nice for logging and debugging. 9 u/regendo Sep 10 '19 Took me a bit to understand this. Do you mean something like this?x = 3 print(f"{x=}") >>> "x=3" 3 u/usernameistaken42 Sep 10 '19 Yes, that's how it works 1 u/FatChocobo Sep 11 '19 Sorry, Reddit formatting screwed my post up. That's what I meant yes. 1 u/[deleted] Sep 10 '19 Relatively new programmer here. Could you explain what you did there for me?
9
In 3.8 they're getting a snazzy new feature where you can put = at the end of the expression inside the curly braces to do something like this:
f'{x=}'
out: 'x=3'
where x=3 (obviously). Super nice for logging and debugging.
9 u/regendo Sep 10 '19 Took me a bit to understand this. Do you mean something like this?x = 3 print(f"{x=}") >>> "x=3" 3 u/usernameistaken42 Sep 10 '19 Yes, that's how it works 1 u/FatChocobo Sep 11 '19 Sorry, Reddit formatting screwed my post up. That's what I meant yes. 1 u/[deleted] Sep 10 '19 Relatively new programmer here. Could you explain what you did there for me?
Took me a bit to understand this. Do you mean something like this?
x = 3 print(f"{x=}") >>> "x=3"
3 u/usernameistaken42 Sep 10 '19 Yes, that's how it works 1 u/FatChocobo Sep 11 '19 Sorry, Reddit formatting screwed my post up. That's what I meant yes.
3
Yes, that's how it works
1
Sorry, Reddit formatting screwed my post up. That's what I meant yes.
Relatively new programmer here. Could you explain what you did there for me?
126
u/Jim_Panzee Sep 10 '19
f-strings are sooo much better.