iterpop makes popping the value out of a singleton container safe and fun
Project description
iterpop
iterpop makes popping the value out of a singleton container or a homogeneous container safe & fun
Free software: MIT license
Documentation: https://iterpop.readthedocs.io.
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'})
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.3.2.tar.gz
(10.7 kB
view hashes)
Built Distribution
Close
Hashes for iterpop-0.3.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d7552f8c4bcf9c7999aa543cd5ac802546e21fbf31a69904f0e5d7d9acae75d |
|
MD5 | e05a9c920dbdff8fb13297dc03cae934 |
|
BLAKE2b-256 | 2cdb8382f45b13532cad3fcec3b0b5102172a668b44a8d0e5cc64ab0272f4c03 |