Check if dictionary empty with == {}

Skip Montanaro skip.montanaro at gmail.com
Wed Aug 19 19:15:09 EDT 2015


Comparison against {} will be less efficient. You need to create a
dictionary every time instead of just checking the length of your
dictionary, which is likely stored in the header. So, it will work, but
certainly isn't idiomatic Python.

Skip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150819/a1a16d06/attachment.html>


More information about the Python-list mailing list