Skip to main content

An improved version of the List built-in

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.

Contributing to Listo

Have you tried using Listo and found it useful? Do you have ideas for how to make it better?

We welcome contributions from the community!

See CONTRIBUTING.md for details on how to set up your development environment to contribute to this project, run tests, check code quality, release new versions, and more.

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.8.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

listo-0.8.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: listo-0.8.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for listo-0.8.0.tar.gz
Algorithm Hash digest
SHA256 7f26653a12aeaa79e98a7aee08bf6742eb1e0278e065a3d441b4f3452c194e9a
MD5 3a5f0d1e0699640c3c996130f211c613
BLAKE2b-256 bd50993282705addad37d401c393811ee8d261e53e4af15a7f1b132f39a220da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: listo-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for listo-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64af590b05538cdd969cee3104f481535d74386f9449865cacbdf7fcfac0c3a4
MD5 c077e8bddee18c5afefb1beaae88fc75
BLAKE2b-256 afb985cff9cfb50ada2614b07ad47577f93cbe0740c39cda4737b9ad24436c1a

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