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 safe and 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.2.2.tar.gz
(10.4 kB
view hashes)
Built Distribution
Close
Hashes for iterpop-0.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98125500246cea8d7335eb658e1f9078d7993ea61894b2dcc1a2abe465f3c3b9 |
|
MD5 | ecb9c54fcb7df3f92279a2067ee1d69e |
|
BLAKE2b-256 | 29a1100491dbe46ca3bd80b52592284d51b03fe72bb3e0a481acb2cf0c96e825 |