Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'compiler': 0.07; '"or': 0.09; 'type,': 0.09; 'works.': 0.09; 'cc:addr:python-list': 0.11; '"int': 0.16; 'accepts': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'list"': 0.16; 'parts,': 0.16; 'wrote:': 0.18; 'figures': 0.19; 'not,': 0.20; 'feb': 0.22; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'string,': 0.24; 'mon,': 0.24; 'paul': 0.24; 'regardless': 0.24; 'cc:2**0': 0.24; 'compare': 0.26; 'pass': 0.26; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'int,': 0.31; 'writes:': 0.31; 'maybe': 0.34; 'knows': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'right?': 0.36; 'error.': 0.37; 'reports': 0.37; 'so,': 0.37; 'two': 0.37; 'pm,': 0.38; 'how': 0.40; 'matter': 0.61; 'telling': 0.64; 'different': 0.65; 'subject:! ': 0.74; '2015': 0.84; 'legal?': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=trav8OIIXqDnCbYcIq8jA6LVyhT/Do7/sNp/WwktXFs=; b=0/GKBLSjI4aJ+is2CBeR8AjHHEDKogb9B6iBOy5yQhhN2++HCt0ljYOhpEg7bjlafA zWsGUQvnrIjVTJH/nNfCpFWB2bKxsPOarvmJi8EEF6+ZIyjgrCpJTIlZDepJj7akM6RM irKlvLfqbL0Gx37CHHJW9C5WOvNbUnqrWSRWERByKaO5tR28Gv5QWHkbKuMvW1fC0lca 6cJhnt0NX96CEfC6UgWoUCS1YoB8cbhoSevQehb6aLcJ+cDhRjsRScaJH1ODXqWgOqDX 4eI0Kc8r2SoUlH/PKg0O3/ga5jDYscUp2UPYzSDWlKVZ2646ut3t6qfazOUg17mX5lqJ LDqA== MIME-Version: 1.0 X-Received: by 10.42.200.136 with SMTP id ew8mr16963267icb.59.1422857768118; Sun, 01 Feb 2015 22:16:08 -0800 (PST) In-Reply-To: <87lhkg3ky7.fsf@jester.gateway.sonic.net> References: <54c07d04$0$13012$c3e8da3$5496439d@news.astraweb.com> <35a40ec6-3763-448b-9ea4-4a233a04979b@googlegroups.com> <54c1ccc8$0$13005$c3e8da3$5496439d@news.astraweb.com> <54c6d7c2$0$12992$c3e8da3$5496439d@news.astraweb.com> <54c83ab4$0$12982$c3e8da3$5496439d@news.astraweb.com> <54ca583e$0$13005$c3e8da3$5496439d@news.astraweb.com> <54ccc2fc$0$13009$c3e8da3$5496439d@news.astraweb.com> <8761bm40ud.fsf@jester.gateway.sonic.net> <54ce54d1$0$12989$c3e8da3$5496439d@news.astraweb.com> <87lhkg3ky7.fsf@jester.gateway.sonic.net> Date: Mon, 2 Feb 2015 17:16:08 +1100 Subject: Re: Python is DOOMED! Again! From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422857771 news.xs4all.nl 2830 [2001:888:2000:d::a6]:55388 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 5341 X-Received-Body-CRC: 3881294874 Xref: csiph.com comp.lang.python:85058 On Mon, Feb 2, 2015 at 5:07 PM, Paul Rubin wrote: > Chris Angelico writes: >> So since you can set something to Nothing regardless of type, and >> compare it against Nothing regardless of type, it doesn't really much >> matter that there are different types of Nothing. Right? > > No that's not how type inference works. If you have x = Nothing and > pass it to a function that takes a Maybe Int, type inference means the > compiler figures out that x must have type Maybe Int. If you then also > pass x to something that takes Maybe String, you are telling the > compiler that x has two different types at the same time, so the > compiler reports a type error. If you say "x = 5" and pass it to a function that accepts "Int or String", the compiler knows that it's actually an Int. If you then also pass that x to something that takes "Int or List", is that legal? If so, then 5 is separate from the "or String" and "or List" parts, and Nothing is actually typed. If not, then it's x, not Nothing, that has the type. ChrisA