Sorting distionary by value

Terry Reedy tejarex at yahoo.com
Fri Mar 29 03:03:55 EST 2002


"phil hunt" <philh at comuno.freeserve.co.uk> wrote in message
news:slrnaa7e6a.eau.philh at comuno.freeserve.co.uk...
> On Thu, 28 Mar 2002 12:01:15 -0800, Jeff Shannon <jeff at ccvcorp.com>
wrote:
> >I disagree.  I'm just as happy that Python doesn't try to guess
what would be a
> >suitable "default" value for non-existent keys.
>
> The default value should always be None.
>
> None should act like 0 or "" or [] or {} where appropriate, i.e.:
>
>    None + 1 --> 1
>    None + "x" --> "x"
>    None * 4 --> 0
>    None + ['x'] --> ['x']
>    None + {2:3} --> {2:3}

Please no!.  A missing value is missing, and should not be used for
any further analysis!  Having a 'no value' built into the language is
one of the nice things about Python.

Terry J. Reedy (sometime statistical consultant)






More information about the Python-list mailing list