Michele Petrazzo wrote:
> Bruno Desthuilliers wrote:
> >> but what the better
> >
> > Depends on the context.
> >
>
> If know only one context: see if the key are into the dict... What other
> context do you know?
>
> Michele

Perhaps Bruno meant this:

try:
   ... my_dict[key] ...
except:
...

when we expect that the key will most often be in my_dict so that
exception will be raised rarely, otherwise use

if key in dict 

André

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to