{"id":702,"date":"2009-06-06T21:24:01","date_gmt":"2009-06-06T20:24:01","guid":{"rendered":"http:\/\/fiber-space.de\/wordpress\/?p=702"},"modified":"2009-06-06T21:24:01","modified_gmt":"2009-06-06T20:24:01","slug":"singular-irregularities","status":"publish","type":"post","link":"http:\/\/fiber-space.de\/wordpress\/2009\/06\/06\/singular-irregularities\/","title":{"rendered":"Singular irregularities"},"content":{"rendered":"<p>An irregularity is a shape or rule violation. It supposes that objects are built according to rules but there are exceptional cases that don&#8217;t really fit or do at least violate our expectations of the building law. An irregularity is singular if the building law is violated in a single case.<\/p>\n<p>The best known example in Python is the syntax of tuples:<\/p>\n<pre lang=\"python\">()                          # empty tuple\r\n(arg)                       # parenthesized expression - no tuple!\r\n(arg,)                      # tuple with one element\r\n(arg1, arg2, ...)           # tuple with many arguments<\/pre>\n<p>Another more recent example is the set syntax in Python 3 which requires an ambiguity resolution involving an empty set and an empty dict:<\/p>\n<pre lang=\"python\">{}                          # empty dict!\r\nset()                       # empty set !\r\n{arg}                       # set with one element\r\n{arg1, arg2, ...}           # set with many elements<\/pre>\n<p>Some people suggested to drop parentheses around arguments in function calls. This leads to an ambiguity between a function object and function call without arguments. In order to resolve it one might introduce another singular irregularity:<\/p>\n<pre lang=\"python\">func                      # object !\r\nfunc arg1 arg2...         # function call with arguments\r\nfunc()                    # function call\r\nfunc(arg1, arg2, ...)     # function call with arguments<\/pre>\n<p>Are singular irregularities design mistakes or are they acceptable trade offs for avoiding verbosity and\/or the introduction of even more syntax?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An irregularity is a shape or rule violation. It supposes that objects are built according to rules but there are exceptional cases that don&#8217;t really fit or do at least violate our expectations of the building law. An irregularity is &hellip; <a href=\"http:\/\/fiber-space.de\/wordpress\/2009\/06\/06\/singular-irregularities\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/posts\/702"}],"collection":[{"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/comments?post=702"}],"version-history":[{"count":6,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/posts\/702\/revisions"}],"predecessor-version":[{"id":708,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/posts\/702\/revisions\/708"}],"wp:attachment":[{"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/media?parent=702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/categories?post=702"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/tags?post=702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}