list index()
Carsten Haese
carsten at uniqsys.com
Fri Aug 31 22:13:16 EDT 2007
On Sat, 2007-09-01 at 13:50 +1200, Lawrence D'Oliveiro wrote:
> In message <mailman.156.1188498891.28954.python-list at python.org>, Carsten
> Haese wrote:
> > has_key() will go away, period. It has been made obsolete by "in", which
> > is faster and more concise.
>
> And is also a backdoor way of introducing non-virtual methods into Python,
> is it not.
If by that you mean that "in" tests can't be overridden, that's not
true:
>>> class LyingDict(dict):
... def __contains__(self, key): return False
...
>>> d = LyingDict()
>>> d[1] = 42
>>> 1 in d
False
If you mean something else, please clarify.
--
Carsten Haese
http://informixdb.sourceforge.net
More information about the Python-list
mailing list