Python Programming Tools
Project description
pprog
A library for Python programming
Installation
pip install --upgrade pprog
APIs
Functions
identity(value, *args, **kwargs)
returns the first value value
.
perm(values, /, *, cycle)
permutates a list according to a cycle notation.
attrgetter(attr, ..., /, *, default)
instantiates a callable object that fetches the given attribute(s) from its operand, with default value for missing attributes.
itemgetter(item, ..., /, *, default)
instantiates a callable object that fetches the given item(s) from its operand, with muti-level keys and default value for missing items.
Classes
ConstantCreator(value, /, *, copy=False)
instantiates a callable object that returns the same constant when it is called.
PermArgsExecutor(fun, /, *, perm=None)
instantiates a callable object that swaps positional arguments according to a cyclc notation. By default, it permutates the first two arguments.
Usage Examples
>>> from pprog import identity
>>> identity("value", "other_input", key="other_keyword_input")
'value'
>>> from pprog import perm
>>> perm(["a", "b", "c", "d", "e", "f", "g"], [1, 2, 4])
['a', 'c', 'e', 'd', 'b', 'f', 'g']
>>> from pprog import AttrCaller
>>> caller = AttrCaller("upper")
>>> caller("test")
'TEST'
>>> from pprog import ConstantCreator
>>> creator = ConstantCreator("value")
>>> creator()
'value'
>>> from pprog import PermArgsExecutor
>>> executor = PermArgsExecutor(range)
>>> executor(4, 2)
range(2, 4)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pprog-0.0.2.tar.gz
.
File metadata
- Download URL: pprog-0.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a558a275bd48a770c15e43a60c237a9eaebed82d27469f257884f711175e3bcb |
|
MD5 | dca08a9155f3a60c89bb3adfeccfdc9f |
|
BLAKE2b-256 | 3e2b24a4a529e5e6ef229a7c65ba838aad76c4948cd1004b2ddb068015076687 |
File details
Details for the file pprog-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pprog-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a84bb75f1d4c57f474efd4915b305adcffd1292e2f8287cf57314ca4b7b5b7f2 |
|
MD5 | 9c2e2d1c708a5436c572b496ff687ba0 |
|
BLAKE2b-256 | 143f1540e99e057b5edb4b000f391642d13ba1104896856d13b53d3dd6be5532 |