Skip to main content

iterpop makes popping the value out of a singleton container safe and fun

Project description

iterpop

https://img.shields.io/pypi/v/iterpop.svg https://img.shields.io/travis/mmore500/iterpop.svg Documentation Status

iterpop makes popping the value out of a singleton container or a homogeneous container safe & fun

from iterpop import iterpop as ip

# returns 'a'
ip.popsingleton(['a'])
ip.popsingleton({'a'})
ip.popsingleton('a')

# throws
ip.popsingleton([])
ip.popsingleton(set())
ip.popsingleton('')

# throws
ip.popsingleton(['a', 'b'])
ip.popsingleton({'a', 'b'})
ip.popsingleton('ab'})

# returns 'a'
ip.pophomogeneous(['a'])
ip.pophomogeneous({'a'})
ip.pophomogeneous('a')

# also returns 'a'
ip.pophomogeneous(['a', 'a'])
ip.pophomogeneous('aaa')
ip.pophomogeneous('a' for __ in range(100))

# throws
ip.pophomogeneous([])
ip.pophomogeneous(set())
ip.pophomogeneous('')

# throws
ip.pophomogeneous(['a', 'b'])
ip.pophomogeneous({'a', 'b'})
ip.pophomogeneous('ab'})

# returns 'a'
ip.poursingleton(['a'])
ip.poursingleton({'a'})
ip.poursingleton('a')

# returns None
ip.poursingleton([])
ip.poursingleton(set())
ip.poursingleton('')

# throws
ip.poursingleton(['a', 'b'])
ip.poursingleton({'a', 'b'})
ip.poursingleton('ab'})

# returns 'a'
ip.pourhomogeneous(['a'])
ip.pourhomogeneous({'a'})
ip.pourhomogeneous('a')

# also returns 'a'
ip.pourhomogeneous(['a', 'a'])
ip.pourhomogeneous('aaa')
ip.pourhomogeneous('a' for __ in range(100))

# returns None
ip.pourhomogeneous([])
ip.pourhomogeneous(set())
ip.pourhomogeneous('')

# throws
ip.pourhomogeneous(['a', 'b'])
ip.pourhomogeneous({'a', 'b'})
ip.pourhomogeneous('ab'})

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2020-07-06)

  • First release on PyPI.

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

iterpop-0.4.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

iterpop-0.4.1-py2.py3-none-any.whl (4.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file iterpop-0.4.1.tar.gz.

File metadata

  • Download URL: iterpop-0.4.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for iterpop-0.4.1.tar.gz
Algorithm Hash digest
SHA256 36d1a20a15b4c7afcd3db0a265dce0f5a6e0bbefb712f955667abbddd68fa471
MD5 a91c6ed8183add986cd58e1952f4d3a2
BLAKE2b-256 5772e4ebfe83d3cd70895e9c3eddd34dad7d01b7484de442d23d5cd66bd4935d

See more details on using hashes here.

File details

Details for the file iterpop-0.4.1-py2.py3-none-any.whl.

File metadata

  • Download URL: iterpop-0.4.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for iterpop-0.4.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8290df022defb9dda2e3e29a9ae99ecc75ed21908966d3421e9300657c698feb
MD5 c73e75ebca30d4e31171879d4e2f0fc9
BLAKE2b-256 eca2b7e4fee1bb1749b8c7e27d520dd747fc16c920d0aadf6323324d88cb7a72

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