[Tutor] dictionary vs. list considerations

Andrei Kulakov ak@silmarill.org
Sun, 16 Dec 2001 16:44:01 -0500


On Sun, Dec 16, 2001 at 03:36:40PM -0600, Rob McGee wrote:
> For what I want to do a dictionary would be a little easier to use, but
> a list could suffice. What kind of considerations (such as performance
> and memory use) are there in deciding which to use? I don't mind having
> a little bit more code (to retrieve my objects out of a list) if it's
> faster or uses less memory than a dictionary.
> 
> Thanks,
>     Rob - /dev/rob0

I think dictionary is usually faster, but it depends on circumstances.
Besides, the rule of thumb is that even gurus often make mistakes when
guessing performance of different approaches, so if you're concerned
with speed at all, try both ways and time 'em.

> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org