[Python-bugs-list] [ python-Bugs-449613 ] Mapping Type "in" and "not in" operators

noreply@sourceforge.net noreply@sourceforge.net
Thu, 09 Aug 2001 14:05:58 -0700


Bugs item #449613, was opened at 2001-08-09 14:00
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=449613&group_id=5470

>Category: Documentation
Group: Python 2.1.1
Status: Open
Resolution: None
>Priority: 6
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Fred L. Drake, Jr. (fdrake)
>Summary: Mapping Type "in" and "not in" operators

Initial Comment:
According to the Python 2.1 documentation, Mapping 
Types support the "in" and "not in" operation.
http://www.python.org/doc/current/lib/typesmapping.html

But it doesn't work.  I tried the following:

>>> k = "key"
>>> a = { k : "value" }
>>> k in a
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: 'in' or 'not in' needs sequence right 
argument

-Mike

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-08-09 14:05

Message:
Logged In: YES 
user_id=31435

Changed to Docs and assigned to Fred.  The use of 
infix "in" with a mapping object is a new-in-2.2 feature.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=449613&group_id=5470