[Python-Dev] Got None. Maybe Some?

Guido van Rossum guido at python.org
Sun Dec 21 19:49:54 EST 2003


> I'm a new lurker (hoping to change that) here on the python-dev list,
> and I thought I would post a message about a new PEP I recently
> submitted entitled "A Case for Some".
> 
> The PEP talks about how there exists None, that is false, and that is
> smaller than any other object ( min(None, a) -> None ).  However, there
> doesn't exist an equivalent true value that is larger than any other
> number, like ( max(Some, a) -> Some ).
> 
> Personally, I think the introduction of Some offers a nice compliment to
> None, especially because it allows algorithms that require an
> initialization of infinity to not require large numbers.  Some would be
> sufficient.  It also has the side benefit of being funny.
> 
> I just wanted to get the discussion going.  How does everyone feel about
> Some?

-1.  Depending on your algorithm you can already use sys.maxint, or a
large float (e.g. 1e300), or you can write 1e1000 (or 1e300**2) which
on most systems evaluates to a floating point Infinity.  And "Some"
sounds like a really strange spelling of "Infinity".  There's also a
PEP (PEP 754) to add a proper way to spell floating point Infinity.
Or you could reverse signs and use min(None, -a).

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list