MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/igvny1/python_goes_brrrr/g2wejbv?context=9999
r/ProgrammerHumor • u/das_freak • Aug 26 '20
789 comments sorted by
View all comments
797
f"Python goes b{'r'*10}"
367 u/Jeb_Jenky Aug 26 '20 This made my nips so hard. 314 u/xDarkFlame25 Aug 26 '20 Ah yes fstrings, the ultimate fetish. 155 u/AinsleyBoy Aug 26 '20 I fucking love fstrings. I use them so much 42 u/Moldy_pirate Aug 26 '20 Is there ever a reason to use a “regular” string rather than an f”string? 78 u/GenericRedditor12345 Aug 26 '20 If you don’t need the functionality of an f string :p They’ve been optimized to be faster than the other formatting methods IIRC. 22 u/thirdegree Violet security clearance Aug 26 '20 Logging, there you want to do like:logging.info("value1: %s, value2: %s", 1, 2)This is because the formatting is only done if the log line will actually be emitted. It can be a significant performance boost if you have a lot of logging. 5 u/[deleted] Aug 26 '20 You can always have a lazy evaluation, using str::format, i. e. log("python goes b{0}", 'r'*10). The string would only format if it were to be used. → More replies (3) → More replies (1) → More replies (12) → More replies (4) → More replies (2)
367
This made my nips so hard.
314 u/xDarkFlame25 Aug 26 '20 Ah yes fstrings, the ultimate fetish. 155 u/AinsleyBoy Aug 26 '20 I fucking love fstrings. I use them so much 42 u/Moldy_pirate Aug 26 '20 Is there ever a reason to use a “regular” string rather than an f”string? 78 u/GenericRedditor12345 Aug 26 '20 If you don’t need the functionality of an f string :p They’ve been optimized to be faster than the other formatting methods IIRC. 22 u/thirdegree Violet security clearance Aug 26 '20 Logging, there you want to do like:logging.info("value1: %s, value2: %s", 1, 2)This is because the formatting is only done if the log line will actually be emitted. It can be a significant performance boost if you have a lot of logging. 5 u/[deleted] Aug 26 '20 You can always have a lazy evaluation, using str::format, i. e. log("python goes b{0}", 'r'*10). The string would only format if it were to be used. → More replies (3) → More replies (1) → More replies (12) → More replies (4) → More replies (2)
314
Ah yes fstrings, the ultimate fetish.
155 u/AinsleyBoy Aug 26 '20 I fucking love fstrings. I use them so much 42 u/Moldy_pirate Aug 26 '20 Is there ever a reason to use a “regular” string rather than an f”string? 78 u/GenericRedditor12345 Aug 26 '20 If you don’t need the functionality of an f string :p They’ve been optimized to be faster than the other formatting methods IIRC. 22 u/thirdegree Violet security clearance Aug 26 '20 Logging, there you want to do like:logging.info("value1: %s, value2: %s", 1, 2)This is because the formatting is only done if the log line will actually be emitted. It can be a significant performance boost if you have a lot of logging. 5 u/[deleted] Aug 26 '20 You can always have a lazy evaluation, using str::format, i. e. log("python goes b{0}", 'r'*10). The string would only format if it were to be used. → More replies (3) → More replies (1) → More replies (12) → More replies (4) → More replies (2)
155
I fucking love fstrings. I use them so much
42 u/Moldy_pirate Aug 26 '20 Is there ever a reason to use a “regular” string rather than an f”string? 78 u/GenericRedditor12345 Aug 26 '20 If you don’t need the functionality of an f string :p They’ve been optimized to be faster than the other formatting methods IIRC. 22 u/thirdegree Violet security clearance Aug 26 '20 Logging, there you want to do like:logging.info("value1: %s, value2: %s", 1, 2)This is because the formatting is only done if the log line will actually be emitted. It can be a significant performance boost if you have a lot of logging. 5 u/[deleted] Aug 26 '20 You can always have a lazy evaluation, using str::format, i. e. log("python goes b{0}", 'r'*10). The string would only format if it were to be used. → More replies (3) → More replies (1) → More replies (12) → More replies (4)
42
Is there ever a reason to use a “regular” string rather than an f”string?
78 u/GenericRedditor12345 Aug 26 '20 If you don’t need the functionality of an f string :p They’ve been optimized to be faster than the other formatting methods IIRC. 22 u/thirdegree Violet security clearance Aug 26 '20 Logging, there you want to do like:logging.info("value1: %s, value2: %s", 1, 2)This is because the formatting is only done if the log line will actually be emitted. It can be a significant performance boost if you have a lot of logging. 5 u/[deleted] Aug 26 '20 You can always have a lazy evaluation, using str::format, i. e. log("python goes b{0}", 'r'*10). The string would only format if it were to be used. → More replies (3) → More replies (1) → More replies (12)
78
If you don’t need the functionality of an f string :p They’ve been optimized to be faster than the other formatting methods IIRC.
22
Logging, there you want to do like:
logging.info("value1: %s, value2: %s", 1, 2)
This is because the formatting is only done if the log line will actually be emitted. It can be a significant performance boost if you have a lot of logging.
5 u/[deleted] Aug 26 '20 You can always have a lazy evaluation, using str::format, i. e. log("python goes b{0}", 'r'*10). The string would only format if it were to be used. → More replies (3) → More replies (1)
5
You can always have a lazy evaluation, using str::format, i. e. log("python goes b{0}", 'r'*10). The string would only format if it were to be used.
str::format
log("python goes b{0}", 'r'*10)
→ More replies (3)
797
u/geeshta Aug 26 '20
f"Python goes b{'r'*10}"