Skip to main content

An improved version of the List type

Project description

listo

Listo is an enhanced version of the list type that aims to do the following:

  • Make behavior more consistent. No more methods with "in-place" changes. Every method call returns a value
  • Adds methods that are missing from the list type. For example, listo has a first method that returns self[0]
  • A list of arguments passed in will be converted to a listo object, but a single argument that is an iterator will be unpacked into a listo object. This is useful for when you want to pass in a generator or other iterator into a function that expects a list

Usage

First install it via pip, poetry, or whatever you use

pip install listo

Then use it in your code

from listo import listo

lst = listo(1, 2, 3)
assert lst.first() == 1
assert lst.last() == 2

Usage: How listo handles initial arguments

For arguments passed in, it just converts them to a listo object

lst = listo(1, 2, 3)
assert lst == [1, 2, 3]

lst2 = listo([1, 2, 3]) # list is unpacked
assert lst2 == [1, 2, 3]

lst3 = listo((1, 2, 3)) # tuple is converted and unpacked
assert lst3 == [1, 2, 3]

lst4 = listo([1, 2, 3], (1, 2))  # Two args mean nothing is unpacked
assert lst4 == [[1, 2, 3], (1, 2)]

This is different from standard Python iterator behavior.

Development

Install the package in editable mode with test dependencies:

pip install -e '.[test]'

Code quality

make lint

Testing

make test

Releasing on PyPI

  1. Update the version in pyproject.toml. We use semantic versioning
  2. Create and merge a PR branch called release-x.x.x
  3. Pull from `main``
  4. At the command line, run make tag
  5. Go to tags page, choose the most recent tag, and click Draft a new release

Building the project locally

Go to the project root

pip install --upgrade build
python -m build

Test the project, forcing reinstall if necessary

pip install dist/listo-0.1.0-py3-none-any.whl --force-reinstall

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

listo-0.5.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

listo-0.5.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file listo-0.5.0.tar.gz.

File metadata

  • Download URL: listo-0.5.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for listo-0.5.0.tar.gz
Algorithm Hash digest
SHA256 391d88f3f8c3226420407bddb114ef6ede309ba3f18e16e100198c916b031e54
MD5 c0e0e57e98760199d2a64ee7c24443bf
BLAKE2b-256 d39f40c8e5ab65b58a338d865040ddd9c6e70aa29a878ead50b80dc57da92a8a

See more details on using hashes here.

File details

Details for the file listo-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: listo-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for listo-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4873bcefb136a902b0ae6a117b95e2a84fe2cae67ee10742e5c9a58ddbaceafe
MD5 c4325a71629a745deb83cebd304e16e3
BLAKE2b-256 bc0fa5a2fed2703e0ffd25ca74dcf15232cb02de0500644eb19d1b2519da834e

See more details on using hashes here.

Supported by

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