"Rustom Mody" <[EMAIL PROTECTED]> wrote:
> Can someone who knows about python internals throw some light on why >>>> x in dic > is cheaper than >>>> dic.has_key(x) > > ?? > Some special methods are optimised by having a reserved slot in the data structure used to implement a class. The 'in' operator uses one of these slots so it can bypass all the overheads of looking up an attribute such as 'has_key'. -- http://mail.python.org/mailman/listinfo/python-list