[CentralOH] Python Puzzler -- The little max bug: Use dict.setdefault()

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Wed Mar 11 02:21:27 CET 2015


On Tue, 10 Mar 2015 21:04:16 -0400, jep200404 at columbus.rr.com wrote:

> Better yet, change the try/except stuff to:
> 
>     if hour not in hoursdict:
>         hoursdict[hour] = {}
>     hourdict = hoursdict[hour]

Better yet:

    hourdict = hoursdict.setdefault(hour, {})


More information about the CentralOH mailing list