[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: ... > > > > if 'a' in thedict: ... > > > if thedict.has_key('a'): ... > > Why consume twice as much time with no advantages whatever?! > > Did I wander into comp.lang.perl by mistake?
Of course not -- note that the faster, modern idiom is also simpler, more concise, _and_ more readable, _and_ also more general/polymorphic than the tired old way that's still kept around only for backwards compatibility. Simplicity, terseness, readability, generality, _and_ speed, all at the same time, as long as you use the "new" way (meaning, in this case, the one that's been around for "only" about seven years...!!!) -- now that's a combination of factors that's reasonably typical of Python, but not quite so frequent in other languages!-) Alex -- http://mail.python.org/mailman/listinfo/python-list