Re: Way for see if dict has a key
- From: Bruno Desthuilliers <onurb@xxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 17:17:48 +0200
Fredrik Lundh wrote:
Bruno Desthuilliers wrote:
on my machine, "key in dict" is about twice as fast as the full
try/getitem construct when the key is present in the dict,
Doesn't it depends on the number of keys in the dict ?
why would it depend on the number of keys in the dict ?
</F>
Seems that if "key in dict" do a simple linear search, it depends on the
number of keys in dict (and the position of the searched key etc...).
And if I'm missing the point and you it and you know why, it would be
simple to explain than to answer my question with another question.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb@xxxxxxxxxxx'.split('@')])"
.
- Follow-Ups:
- Re: Way for see if dict has a key
- From: Fredrik Lundh
- Re: Way for see if dict has a key
- From: Eric Deveaud
- Re: Way for see if dict has a key
- References:
- Way for see if dict has a key
- From: Michele Petrazzo
- Re: Way for see if dict has a key
- From: Bruno Desthuilliers
- Re: Way for see if dict has a key
- From: Michele Petrazzo
- Re: Way for see if dict has a key
- From: André
- Re: Way for see if dict has a key
- From: Fredrik Lundh
- Re: Way for see if dict has a key
- From: Bruno Desthuilliers
- Re: Way for see if dict has a key
- From: Fredrik Lundh
- Way for see if dict has a key
- Prev by Date: Re: Chapter 9 Tutorial for Classes Not Working
- Next by Date: Re: Reddit broke - should have remained on Lisp?
- Previous by thread: Re: Way for see if dict has a key
- Next by thread: Re: Way for see if dict has a key
- Index(es):
Relevant Pages
|