6 ms·
I'm no pythonist, but I think setdefault would be perfect for the case http://docs.python.org/library/stdtypes.html#dict.setdefault http://docs.python.org/libr
by locci 14y ago
I'm no pythonist, but I think setdefault would be perfect for the case
http://docs.python.org/library/stdtypes.html#dict.setdefault http://docs.python.org/library/stdtypes.html#dict.setdefault
- b0rsuk 14y agoI agree. The author uses exception for something that is not at all exceptional. In fact, it will occur at least once. This is misuse of an exception. No one expects Spanish Exception! Earlier, he uses the map function for no apparent reason. I mean - list comprehension would perfectly fit here. I still think I have something to learn from the article, though.