John Yeung <gallium.arsen...@gmail.com> writes: > Because you might want None to behave as though it were nothing at all.
Sure, you might also want strings to behave as if they were ints, but wishing doesn't make it so. > But mathematically speaking, it's intuitive that "nothing" would match > any type. Completely wrong. The concept you're thinking of in denotational semantics is called "bottom", but bottom is not a value that functions can compute and return. It is really the absence of a value. We would say that a function semantically returns bottom, if calling does something like loop forever (never return), or it makes the program crash, or something like that. None is a value which in Haskell has a particular type. In some other languages, there are None-like values in more than one type, like in Haskell, for any type there is a Nothing for the Maybe of that type, but they all are of differing types, just like Python has an integer 0 and a floating point 0 that are of differing types. > I find that it's somewhat like the confusion that often occurs > regarding the all() function. It's the other way though, all([])=True makes sense, isinstance(None,int) does not. -- http://mail.python.org/mailman/listinfo/python-list