-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Nagle wrote:
> What's the cheapest way to test for an empty dictionary in Python?
>
> if len(dict.keys() > 0) :
>
> is expensive for large dictionaries, and makes loops O(N^2).
>
> John Nagle
if dict:
...
:)
- --
- ---[Office 68.7F]--[Outside 42.9F]--[Server 100.4F]--[Coaster 68.0F]---
- ---[ KLAHOWYA WSF (366773110) @ 47 31.2076 -122 27.2249 ]---
Software, Linux, Microcontrollers http://www.brianlane.com
AIS Parser SDK http://www.aisparser.com
Movie Landmarks Search Engine http://www.movielandmarks.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Remember Lexington Green!
iD8DBQFH5nz/Iftj/pcSws0RAnnMAJoDX9P0cK+RshuvuRRfkyJ4CPwqxACeMWkF
pq7AKr/qzVWyVat0QiTtUfo=
=bpei
-----END PGP SIGNATURE-----
--
http://mail.python.org/mailman/listinfo/python-list