>>>>> Paul Rubin <http://phr...@nospam.invalid> (PR) wrote:
>PR> Paul Rubin <http://phr...@nospam.invalid> writes: >>> crash, or something like that. None is a value which in Haskell has a >PR> I got ahead of myself, of course I meant Python (the *next* sentence >PR> was going to mention Haskell). The corresponding concept in Haskell >PR> is called Nothing, which lives in a type functor called Maybe. I >PR> don't have time to go into it right now but there is a notion among >PR> language weenies these days that the presence of something like None >PR> (in Python) or Null (in Java, SQL, etc) is a wart in a language and >PR> that it's preferable to have something like Maybe. The reason is that in Haskell the type system doesn't have union types. Instead it has the disjoint sum, and Maybe is just one of them. Otherwise you could have used the union of Nothing and any other type. In Python there is no reason to use a disjoint sum as Python doesn't use static typing. You can use unions of types at your hearts desire. So I don't think there is not much difference between None and Nothing, except for the type system. Java, on the other hand does have static typing but does not have disjoint sums. So they have not much choice but to put null in every class-based type. -- Piet van Oostrum <p...@cs.uu.nl> URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list