[Tutor] quick speed question

C.T. Matsumoto c.t.matsumoto at gmail.com
Thu Sep 16 09:13:21 CEST 2010

Hello Tutors,

I was just wondering if you have a dictionary key is it faster to do:

if dict['key'] == 'foo':

or is this faster:

if 'foo' in dict['key']:

Or is there any difference and I'm chasing ghosts?


C.T. Matsumoto
Claes de Vrieselaan 60a III
3021 JR Rotterdam
The Netherlands

tel.: +31 (0)6 41 45 08 54

More information about the Tutor mailing list