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.4.tar.gz
(10.7 kB
view hashes)
Built Distribution
Close
Hashes for iterpop-0.3.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca68bf22df73c7eea1baba3fc040b6548bfaaecb741ea5fb34e6b4b44c08aacd |
|
MD5 | df92901266fdf5f3fe851cbccaec7609 |
|
BLAKE2b-256 | ad2f8f557566b0eb16674d21b493fe9970f775bfd0d7baf77db1d037f3a0c8e4 |