Skip to main content

A case-insensitive list for Python

Project description

Version on Pypi Actions status Docs build status (master) Test coverage (master)

Overview

Class NocaseList is a case-insensitive list that preserves the lexical case of its items.

Example:

$ python
>>> from nocaselist import NocaseList

>>> list1 = NocaseList(['Alpha', 'Beta'])

>>> print(list1)  # Any access is case-preserving
['Alpha', 'Beta']

>>> 'ALPHA' in list1  # Any lookup or comparison is case-insensitive
True

The NocaseList class supports the functionality of the built-in list class of Python 3.8 on all Python versions it supports (except for being case-insensitive, of course). This includes the clear() and copy() methods added in Python 3.3 to the built-in list class.

The case-insensitivity is achieved by matching any list values as their casefolded values. By default, the casefolding is performed with str.casefold() on Python 3 and with str.lower() on Python 2. The default casefolding can be overridden with a user-defined casefold method.

Installation

To install the latest released version of the nocaselist package into your active Python environment:

$ pip install nocaselist

The nocaselist package has no prerequisite Python packages.

For more details and alternative ways to install, see Installation.

Documentation

Change History

Contributing

For information on how to contribute to the nocaselist project, see Contributing.

License

The nocaselist project is provided under the Apache Software License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nocaselist-1.1.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nocaselist-1.1.0-py2.py3-none-any.whl (12.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file nocaselist-1.1.0.tar.gz.

File metadata

  • Download URL: nocaselist-1.1.0.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nocaselist-1.1.0.tar.gz
Algorithm Hash digest
SHA256 a99384abc700c409e9def7143763e18dfad332fdff7e30fae1f6d1a30b372772
MD5 8f721b56a7520cab892efb51e294995c
BLAKE2b-256 e61503b06752cfd7578bca701a0a68966f796d2602dfc489b2b18ff86afed4c1

See more details on using hashes here.

File details

Details for the file nocaselist-1.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: nocaselist-1.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nocaselist-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7b49186b623ccdab8e6f90038af2a24438389502498d0e7d04d6d3c1f641643b
MD5 96e4ec7847a3dd9d828c2912ce9d9c13
BLAKE2b-256 5bf7bb8dcfc6d51bdb3038fc81f8aeaefaf360999a86d66c6d02bf950903d01b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page