{"id":261,"date":"2010-01-07T14:07:44","date_gmt":"2010-01-07T20:07:44","guid":{"rendered":"http:\/\/www.philhassey.com\/blog\/?p=261"},"modified":"2010-01-07T14:07:44","modified_gmt":"2010-01-07T20:07:44","slug":"is-none-more-like-0-or-1","status":"publish","type":"post","link":"https:\/\/www.philhassey.com\/blog\/2010\/01\/07\/is-none-more-like-0-or-1\/","title":{"rendered":"Is None more like 0 or -1 ?"},"content":{"rendered":"<p>In tinypyC++ every variable is a certain type. \u00a0In some cases I may have an int x = None; \u00a0But I&#8217;m not sure what that should mean?<\/p>\n<p>What&#8217;s the most pythonic?  Here&#8217;s some anecdotal evidence:<\/p>\n<pre>&gt;&gt;&gt; None,None==None,None==-1,None==0,None==1,None==False,None==True,bool(None)\r\n(None, True, False, False, False, False, False, False)\r\n&gt;&gt;&gt; -1,-1==None,-1==-1,-1==0,-1==1,-1==False,-1==True,bool(-1)\r\n(-1, False, True, False, False, False, False, True)\r\n&gt;&gt;&gt; 0,0==None,0==-1,0==0,0==1,0==False,0==True,bool(0)\r\n(0, False, False, True, False, True, False, False)\r\n&gt;&gt;&gt; 1,1==None,1==-1,1==0,1==1,1==False,1==True,bool(1)\r\n(1, False, False, False, True, False, True, True)<\/pre>\n<p>So .. you can see -1 gets 4\/7. \u00a00 also gets 4\/7. \u00a0(1 gets a mere 3\/7, so it&#8217;s out.)<\/p>\n<p>Anyone care to tilt the scales to -1 or 0?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In tinypyC++ every variable is a certain type. \u00a0In some cases I may have an int x = None; \u00a0But I&#8217;m not sure what that should mean? What&#8217;s the most pythonic? Here&#8217;s some anecdotal evidence: &gt;&gt;&gt; None,None==None,None==-1,None==0,None==1,None==False,None==True,bool(None) (None, True, False, False, False, False, False, False) &gt;&gt;&gt; -1,-1==None,-1==-1,-1==0,-1==1,-1==False,-1==True,bool(-1) (-1, False, True, False, False, False, False, True) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,32],"tags":[],"class_list":["post-261","post","type-post","status-publish","format-standard","hentry","category-python","category-tinypy"],"_links":{"self":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts\/261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/comments?post=261"}],"version-history":[{"count":1,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts\/261\/revisions"}],"predecessor-version":[{"id":262,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/posts\/261\/revisions\/262"}],"wp:attachment":[{"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/categories?post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.philhassey.com\/blog\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}