[Python-ideas] Smallest/Largest singletons

skip at pobox.com skip at pobox.com
Thu Nov 27 19:59:57 CET 2008

    >> Is it maybe the right time to add a builtin Smallest (and also
    >> Largest) object, i.e. two singletons so that `Smallest < x` for every
    >> x: x is not Smallest and `Largest > x` for every x: x is not Largest
    >> ?

    Roberto> Largest  = float('Infinity')
    Roberto> Smallest = float('-Infinity')


    Python 2.7a0 (trunk:67276M, Nov 18 2008, 21:20:11) 
    [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> Smallest = float('-Infinity')
    >>> Largest = float('Infinity')
    >>> Smallest < 'a'
    >>> Largest < 'a'

In short, it will likely work for numbers but not other types.


More information about the Python-ideas mailing list