RepugNaNt [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Wed 2011-12-07 15:45
RepugNaNt
LinkReply
[identity profile] fluffyrichard.livejournal.comThu 2011-12-22 07:27
Actually, that's close to what I'd probably write (though not always; context is everything, and I'd do "except KeyError" not bare except, of course). Though the reason for that is that I wouldn't call the variable tmpvar; I'd give it a meaningful name, and think of it as an opportunity to write more self-documenting code.

I don't think I've ever come across this in practice, though; normally, I just work with dicts which either don't contain None, or where None would be expected to be treated the same as the entry being missing.
Link Reply to this | Parent
navigation
[ go | Previous Entry | Next Entry ]
[ add | to Memories ]