{"id":11370,"date":"2024-02-25T18:19:15","date_gmt":"2024-02-25T17:19:15","guid":{"rendered":"https:\/\/monodes.com\/predaelli\/?p=11370"},"modified":"2024-02-25T18:19:15","modified_gmt":"2024-02-25T17:19:15","slug":"did-you-know-adding-after-an-expression-in-a-python-f-string","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2024\/02\/25\/did-you-know-adding-after-an-expression-in-a-python-f-string\/","title":{"rendered":"Did You Know \u2014 Adding = After an Expression in a Python f-string"},"content":{"rendered":"<p><em><a href=\"https:\/\/levelup.gitconnected.com\/did-you-know-adding-after-an-expression-in-a-python-f-string-b5cf3a029274\">Did You Know \u2014 Adding = After an Expression in a Python f-string | by Liu Zuo Lin<\/a><\/em><\/p>\n<p>&nbsp;<\/p>\n<blockquote>\n<pre class=\"nr ns nt nu nv oc od oe bo of ba bj\"><span id=\"c708\" class=\"og oh hb od b bf oi oj l ok ol\" data-selectable-paragraph=\"\"># eg. f\u2019{x=}\u2019 returns \u2018x=\u2019\n\nn = <span class=\"hljs-number\">5<\/span>\n<span class=\"hljs-built_in\">print<\/span>(<span class=\"hljs-string\">f'<span class=\"hljs-subst\">{n+<span class=\"hljs-number\">1<\/span>=}<\/span>'<\/span>)    <span class=\"hljs-comment\"># n+1=6<\/span><\/span><\/pre>\n<pre class=\"qg oc od oe bo of ba bj\"><span id=\"0b1f\" class=\"og oh hb od b bf oi oj l ok ol\" data-selectable-paragraph=\"\">n = <span class=\"hljs-number\">5<\/span>\n<span class=\"hljs-built_in\">print<\/span>(<span class=\"hljs-string\">f'<span class=\"hljs-subst\">{n+<span class=\"hljs-number\">10<\/span>=}<\/span>'<\/span>)    <span class=\"hljs-comment\"># n+10=15<\/span><\/span><\/pre>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">Did You Know \u2014 Adding = After an Expression in a Python f-string | by Liu Zuo Lin &nbsp; # eg. f\u2019{x=}\u2019 returns \u2018x=\u2019 n = 5 print(f'{n+1=}&#8217;) # n+1=6 n = 5 print(f'{n+10=}&#8217;) # n+10=15<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2024\/02\/25\/did-you-know-adding-after-an-expression-in-a-python-f-string\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"federated","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[113],"tags":[],"class_list":["post-11370","post","type-post","status-publish","format-standard","hentry","category-python"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-2Xo","jetpack-related-posts":[{"id":11883,"url":"https:\/\/monodes.com\/predaelli\/2024\/08\/28\/python-shared-memory-in-multiprocessing\/","url_meta":{"origin":11370,"position":0},"title":"Python Shared Memory in Multiprocessing","author":"Paolo Redaelli","date":"2024-08-28","format":false,"excerpt":"Python Shared Memory in Multiprocessing np_array's size=220.0MB With SharedMemory: ... Current memory usage 0.11283MB; Peak: 0.156706MB Time elapsed: 0.99s No SharedMemory: ... Current memory usage 0.026587MB; Peak: 467.558995MB Time elapsed: 5.48s I think I shall go for shared memory! My Amiga formation years requires it! Python Shared Memory in Multiprocessing\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/monodes.com\/predaelli\/category\/python\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9633,"url":"https:\/\/monodes.com\/predaelli\/2022\/09\/20\/9633\/","url_meta":{"origin":11370,"position":1},"title":"Another interesting article to \"convert\u2026","author":"Paolo Redaelli","date":"2022-09-20","format":false,"excerpt":"Another interesting article to \"convert to Eiffel\".... It's Time to Say Goodbye to These Obsolete Python Libraries It's Time to Say Goodbye to These Obsolete Python Libraries Martin Jul 20, 2022 Python With every Python release, there are new modules being added and new and better ways of doing things\u2026","rel":"","context":"In &quot;Agenda&quot;","block_context":{"text":"Agenda","link":"https:\/\/monodes.com\/predaelli\/category\/agenda\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9532,"url":"https:\/\/monodes.com\/predaelli\/2022\/08\/09\/7-python-one-liners-that-will-blow-your-mind\/","url_meta":{"origin":11370,"position":2},"title":"7 Python One-Liners that will Blow Your Mind","author":"Paolo Redaelli","date":"2022-08-09","format":false,"excerpt":"Xiaoxu Gao wrote 7 Python One-Liners that will Blow Your Mind Less is more? Photo by Photos by Lanty from Unsplash The term one-liner comes from comedy where a joke is delivered in a single line. A good one-liner is said to be meaningful and concise. This concept also exists\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/monodes.com\/predaelli\/category\/python\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6318,"url":"https:\/\/monodes.com\/predaelli\/2019\/12\/15\/eiffels-conditional-expressions\/","url_meta":{"origin":11370,"position":3},"title":"Eiffel&#8217;s conditional expressions","author":"Paolo Redaelli","date":"2019-12-15","format":false,"excerpt":"The ternary conditional operator is a short-hand method for writing an if\/else statement. Does Python Have a Ternary Conditional Operator? Yes, it does. This remids me that Eiffel, at least \"ISE Eiffel\" does actually have conditional expressions that are the same: answer := if time < noon then \"Good morning\"\u2026","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"Jonathan Hsu","src":"https:\/\/i0.wp.com\/miro.medium.com\/fit\/c\/58\/58\/2%2A_KGzadiy9s83D4vzhsCyyg.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":9674,"url":"https:\/\/monodes.com\/predaelli\/2022\/09\/28\/10-powerful-python-one-liners\/","url_meta":{"origin":11370,"position":4},"title":"10 Powerful Python One-Liners.","author":"Paolo Redaelli","date":"2022-09-28","format":false,"excerpt":"I shall Eiffellize those, one day or another: 10 Powerful Python One-Liners. Python one-liners can be just as\u2026 | by Ishaan Gupta | Sep, 2022 | Python in Plain English 10 Powerful Python One-Liners Python one-liners can be just as powerful as a long and tedious program written in another\u2026","rel":"","context":"In &quot;Agenda&quot;","block_context":{"text":"Agenda","link":"https:\/\/monodes.com\/predaelli\/category\/agenda\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2022\/09\/1jLSxNQvNqsYr02VB_wr96A.jpeg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2022\/09\/1jLSxNQvNqsYr02VB_wr96A.jpeg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2022\/09\/1jLSxNQvNqsYr02VB_wr96A.jpeg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":15394,"url":"https:\/\/monodes.com\/predaelli\/2026\/03\/29\/nobody-gets-fired-for-picking-json-but-maybe-they-should\/","url_meta":{"origin":11370,"position":5},"title":"Nobody Gets Fired for Picking JSON, but Maybe They Should?","author":"Paolo Redaelli","date":"2026-03-29","format":"link","excerpt":"Nobody Gets Fired for Picking JSON, but Maybe They Should? By Miguel Young de la Sota Nobody Gets Fired for Picking JSON, but Maybe They Should? JSON is extremely popular but deeply flawed. This article discusses the details of JSON\u2019s design, how it\u2019s used (and misused), and how seemingly helpful\u2026","rel":"","context":"In &quot;Javascript&quot;","block_context":{"text":"Javascript","link":"https:\/\/monodes.com\/predaelli\/category\/javascript\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/11370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/comments?post=11370"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/11370\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=11370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=11370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=11370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}