Determinig position of a element in a list
Przemo Drochomirecki
pedrosch at gazeta.pl
Mon Aug 25 18:29:04 EDT 2003
Hello,
i'm wondering if there is any tricky way for doing following thing:
A - list of distinct integers (e.x. A = [1,3,7,11,14,15])
very fast function determinig position of number x in list A
or -1 if x doesnt belong to A
Operator IN returns only false/true values
i can implement function index (e.x. index(5,A) = -1, index(7,A) = 2), but
maybe there's is simpler(builtin?) solution
Thanks
More information about the Python-list
mailing list