[Edu-sig] Using try / except: any stipulations against routine use?

kirby urner kirby.urner at gmail.com
Wed Dec 14 23:36:43 CET 2011


> Isn't this at least as readable, and conceptually simpler?
>
>    if ext in res_dict:
>        res_dict[ext] += 1
>    else:
>        res_dict[ext] = 1

I get that a lot too and often propose my one-liner.  This is not a
matter of flagging a mistake, just showing another way.

It's a chance to learn dict methods better and hey, they're paying to
have a pro coach.

Kirby


More information about the Edu-sig mailing list