trictionary?

Scott David Daniels Scott.Daniels at Acm.Org
Mon Aug 29 07:43:52 CEST 2005


Randy Bush wrote:
>... i could be a bit more obscure and do
>       if week in bin:
>          bin[week][not full] += 1
>       else:
>          bin[week] = [ full, not full ]

If you cannot take the setdefault advice, at least do:

     try:
         bin[week][not full] += 1
     except KeyError:
         bin[week] = [full, not full]

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list