[Python-Dev] __contains__ hook

Fred L. Drake, Jr. fdrake@acm.org
Thu, 3 Feb 2000 13:25:18 -0500 (EST)


Guido van Rossum writes:
 > Because if we add a slot to the as_sequence struct, old extensions
 > that haven't been recompiled will appear to have garbage in that slot
 > (because they don't actually have it).  When we use a spare slot in
 > the main type struct, that problem doesn't exist; but the as_sequence
 > struct and friends don't have spares.

  Good point.  I still think a spare slot should be used so sets don't 
have to look like sequences.

 > Maybe the docs need to be updated? (Hint, hint.)

  Done in CVS.

 > Yuck.  The same argument for disallowing 'x in dict' applies to the C
 > API.  There's already PyMapping_HasKey().

  Yep!  Poorly conceived notions aren't dependent on syntax.


  -Fred

--
Fred L. Drake, Jr.	  <fdrake at acm.org>
Corporation for National Research Initiatives