[Tutor] searching for a value in an array
Scot W. Stevenson
scot@possum.in-berlin.de
Fri, 6 Sep 2002 01:50:49 +0200
Hello Danny,
> There are faster ways of seeing if someone is present in a group of
> people: we can use a dictionary:
And, just in case anybody is getting funny ideas about Python becoming
stable any time soon, in Python 2.3, you will be able to use "sets"
instead. If I understand the concept, these unordered collections would be
even better here, because they are "hashable" (which seems to be
computerspeak for "the Python Elves can access them really, really
quickly, and their speed doesn't depend on the number of elements") so you
don't have to use those dummy 1's as values of a dictionary like you did
in your example.
What will they ever think of next =8).
Y, Scot
--
Scot W. Stevenson wrote me on Friday, 6. Sep 2002 in Zepernick, Germany
on his happy little Linux system that has been up for 1919 hours
and has a CPU that is falling asleep at a system load of 0.00.