Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rindex

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rindex

rindex() function for sequences

  • 1.1.1
  • PyPI
  • Socket score

Maintainers
1

rindex

This package provides rindex() function that returns last index of value in sequence.

Installing

pip install rindex

Examples

from rindex import rindex


numbers = [5, 1, 3, 8, 10, 5, 8, 1, 8, 3]

print(rindex(numbers, 1))  # 7

print(rindex(numbers, 8, 4, 8))  # 6

Goals

  • Support all features of built-in .index()

  • Speed

  • Portability (support for different platforms)

Supported platforms

Currently, the library includes three rindex() implementations:

  • Cython

  • Pure Python (when the Cython one is not available; slower)

  • Pure Python for PyPy

Features

  • Supports any sequences

  • Supports start and stop (both may be negative or out of bounds)

  • Doesn't copy the sequence

Controlling Cython extensions

You can set environment variable ENABLE_RINDEX_EXTENSIONS to 0 or 1 to forcefully disable/enable Cython extensions. This can be useful if you face compilation problems and want to use pure Python version.

Benchmarking

tests/benchmark.py can generate interactive plots with comparisons of different implementations.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc