On Monday, April 7, 2014 9:08:23 PM UTC-7, Chris Angelico wrote:

> That depends on whether calling Brand() unnecessarily is a problem.
> Using setdefault() is handy when you're working with a simple list or
> something, but if calling Brand() is costly, or (worse) if it has side
> effects that you don't want, then you need to use a defaultdict.
> 

> I think this is a textbook example of why defaultdict exists, though,
> so I'd be inclined to just use it, rather than going for setdefault :)

Thanks for the clarification.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to