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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to