[Python-ideas] Suggestion for Style Guide for Python Code PEP 8

Rahul Amaram amaramrahul at users.sourceforge.net
Thu May 12 15:44:00 CEST 2011


Hi,
I was wondering if the following programming recommendation would be 
added to the Style Guide for Python Code (PEP 8) page.

The preferred way for checking if a key (k) exists in a dictionary (d) 
is "if k in d". This is faster than "if k in d.keys()" and this has 
superseded "d.has_key(k)"

Cheers,
Rahul.



More information about the Python-ideas mailing list