basic question, sorry
Aahz Maruch
aahz at netcom.com
Mon Aug 21 11:39:21 EDT 2000
In article <Fzn7xn.I8v at world.std.com>, Will Ware <wware at world.std.com> wrote:
>
>Yeah, that occurred to me about a half-second after I posted that
>response. in...keys() would work but would impose a huge performance
>lose. (I try to think a little more carefully when writing code
>that I plan to actually run.) The try/except thing looks interesting,
>I'll have to study the later comment that it's substantially faster
>than has_key().
It is substantially faster IFF the key already exists "most" of the time
(I'll guess somewhere around the 80%-90% level). try clauses are
extremely fast; triggering the except is slow.
--
--- Aahz (Copyright 2000 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
"A foolish consistency is the hobgoblin of little minds, adored by little
statesmen and philosophers and divines." -- Ralph Waldo Emerson
More information about the Python-list
mailing list