On Thu, Aug 20, 2015 at 12:44 PM, Steven D'Aprano
<mailto:st...@pearwood.info> wrote:
> Testing for "any Falsey value" and "an empty dict" are not the same,
> naturally they will perform differently.

Sure, but the OP's original note explicitly said he had a dict and
asked how to test if it was empty. He was used to seeing/using "not
mydict", but had recently encountered "mydict == {}".  Given those
preconditions, the correct answer is that "not mydict" is the way to
go (idiomatic Python). Using "mydict == {}" is clearly suboptimal.

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

Reply via email to