"in" for dicts (was: Python 2.1 function attributes)

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Jan 31 23:26:46 EST 2001


Tim Peters wrote:
> 
> Nobody searches phone books or Webster's
> "backwards" in real life.

Indeed! If I were to ask my colleague "Is the word 'bamboozle'
used anywhere in a definition in Webster's dictionary?" the
answer would probably be "Buggered if I know."

Which leads us to what the semantics of
"x in dict" should obviously be:

>>> if x in dict:
...   print "boo:
<stdin>, line 1: BuggeredIfIKnowError

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list