Tom Ritchford
Apr 6, 2023

--

I like your stuff in general, but really, there is rarely a good application for defaultdict.

The downside of using it is that it isn't a dict. If you pass it to some other program and they use it expecting to get an exception when they retrieve a non-existent key, they will be in trouble.

Use dict.setdefault instead, is my advice!

--

--

No responses yet