[Tutor] Iterating a dict with an iteration counter? How would *you* do it?

eryksun eryksun at gmail.com
Tue Feb 5 12:36:39 CET 2013


On Tue, Feb 5, 2013 at 6:27 AM, Oscar Benjamin
<oscar.j.benjamin at gmail.com> wrote:
>
> I almost wrote this response but then I realised that Dave probably
> meant that "obj in dict" returns True if the dict has a key equal to
> obj rather than if the dict has a (key, value) pair equal to obj.

Thanks, that's probably what Steven meant. It's keeping "item in
a_dict" consistent with "item in list(a_dict)".


More information about the Tutor mailing list