Way for see if dict has a key

Alex Martelli aleax at mac.com
Fri Jun 30 11:32:42 EDT 2006


Fredrik Lundh <fredrik at pythonware.com> wrote:

> Michele Petrazzo wrote:
> 
> > what the preferred way for see if the dict has a key?
> > We have a lot of solutions:
> >
> > key in dict
> 
> new syntax (2.3 and later).

Fine with Python 2.2 as well, actually -- so, "new" only in an
_extremely_ loose sense of the word:-).


Alex



More information about the Python-list mailing list