Testing if an index is in a slice

mmanns at gmx.net mmanns at gmx.net
Thu Jan 1 13:15:00 EST 2009


Hi

I would like to check if an index is in a slice or not without
iterating over the slice.

Something like:

>>> isinslice(36, slice(None, 34, -1))
True

I would like to use the batteries if possible.
However, I looked in the docs, pypi and in Usenet without luck.

Does anyone have a solution?

Martin





More information about the Python-list mailing list