Common Python Idioms

Daniel Dittmar daniel.dittmar at sap.com
Thu Dec 7 08:49:34 EST 2006


Duncan Booth wrote:
> In this case, dict objects used to not support the 'in' operator, but at 
> some point it was added. I believe it wasn't there originally because Guido 
> wasn't sure whether people would expect it should match keys or keys and 
> values.

And he was right:

import sys
'sys' in sys.modules => True
sys in sys.modules => False

Doesn't this look wrong?

Daniel



More information about the Python-list mailing list