<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 19, 2015 at 10:16 PM, Steven D'Aprano <span dir="ltr"><<a href="mailto:steve+comp.lang.python@pearwood.info" target="_blank">steve+comp.lang.python@pearwood.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So maybe it's a micro-optimization?</blockquote></div><br>Note, however, that the original post compared "mydict == {}" with "not mydict". In that case, it's decidedly not an optimization:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">firefly% python2.7 -m timeit -s "mydict = {1:2}" "if mydict == {}: pass"</div><div class="gmail_extra">10000000 loops, best of 3: 0.0508 usec per loop</div><div class="gmail_extra">firefly% python2.7 -m timeit -s "mydict = {1:2}" "if not mydict: pass"</div><div class="gmail_extra">10000000 loops, best of 3: 0.0246 usec per loop</div><div><br></div><div>Skip</div><div><br></div></div></div>