{"id":24674,"date":"2019-03-21T15:51:01","date_gmt":"2019-03-21T19:51:01","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=24674"},"modified":"2019-03-21T15:51:01","modified_gmt":"2019-03-21T19:51:01","slug":"why-operators-are-useful","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2019\/03\/21\/why-operators-are-useful\/","title":{"rendered":"Why Operators Are Useful"},"content":{"rendered":"<p><a href=\"http:\/\/neopythonic.blogspot.com\/2019\/03\/why-operators-are-useful.html\">Guido van Rossum<\/a>:<\/p>\n<blockquote cite=\"http:\/\/neopythonic.blogspot.com\/2019\/03\/why-operators-are-useful.html\"><p>The general idea here is that once you&rsquo;ve learned this simple notation, equations written using them are easier to <em>manipulate<\/em> than equations written using functional notation -- it is as if our brains grasp the operators using different brain machinery, and this is more efficient.<\/p><p>[&#8230;]<\/p><p>Now, programming isn&rsquo;t exactly the same activity as math, but we all know that Readability Counts, and this is where operator overloading in Python comes in. Once you&rsquo;ve internalized the simple properties which operators tend to have, using + for string or list concatenation becomes more readable than a pure OO notation, and (2) and (3) above explain (in part) why that is.<\/p><p>Of course, it&rsquo;s definitely possible to overdo this -- then you get Perl.<\/p><\/blockquote>\n<p>Observing the use of <a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/master\/proposals\/0249-key-path-literal-function-expressions.md#-prefix-operator\">custom operators<\/a> can help identify problem spots in a language.<\/p>","protected":false},"excerpt":{"rendered":"<p>Guido van Rossum: The general idea here is that once you&rsquo;ve learned this simple notation, equations written using them are easier to manipulate than equations written using functional notation -- it is as if our brains grasp the operators using different brain machinery, and this is more efficient.[&#8230;]Now, programming isn&rsquo;t exactly the same activity as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2019-03-21T19:51:05Z","apple_news_api_id":"865604ff-5573-4065-8c29-70c615db980d","apple_news_api_modified_at":"2019-03-21T19:51:07Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AhlYE_1VzQGWMKXDGFduYDQ","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[46,259,71,232,901],"class_list":["post-24674","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-languagedesign","tag-math","tag-programming","tag-python","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/24674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=24674"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/24674\/revisions"}],"predecessor-version":[{"id":24675,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/24674\/revisions\/24675"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=24674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=24674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=24674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}