Python is DOOMED! Again!

Paul Rubin no.email at nospam.invalid
Mon Feb 2 01:07:44 EST 2015


Chris Angelico <rosuav at gmail.com> 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.



More information about the Python-list mailing list