I'm going to be doing some work where I'll be doing existence
testings on keys on about a million records where it may require
multiple passes so I'm a bit concerned about the timing of these
tests.

Is there any significant performance difference between the
tests, ``key in dictionary'' and ``dictionary.has_key(key)''?
I would prefer using the ``key in'' because it's a bit easier to
type, and can also be used with lists in addition to dictionaries.

A related question is where's the trade-off between using ``in''
with a list, and a dictionary?  I presume that using it with
small hashes will be faster than dictionries since it doesn't
have to calculate the hashes.

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

Government is the great fiction, through which everbody endeavors to
live at the expense of everybody else.  -- Frederic Bastiat
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to