list index()

Carsten Haese carsten at uniqsys.com
Fri Aug 31 02:58:38 CEST 2007


On Thu, 2007-08-30 at 16:42 -0700, zzbbaadd at aol.com wrote:
> It suddenly dawned on me that what would be best would be a contains()
> (or IN syntax for those who can't afford to wait) for lists.

Either I'm misunderstanding what you mean or you need to get a clue
about what Python can already do before you go around making suggestions
for what Python needs. Lists have supported "in" tests since at least
version 1.5.2:

Python 1.5.2 (#1, Nov  6 1999, 14:53:40) [C] on sco_sv3
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> if 3 in [1,2,3]: print "Yup, got it!"
... 
Yup, got it!

This feature may be older than version 1.5.2, but this is the oldest
version that I still have running anywhere.

-- 
Carsten Haese
http://informixdb.sourceforge.net





More information about the Python-list mailing list