ambiguous
flexibility when you need it
Install
pip install ambiguous
Usage
decorator: allow decorators to accept arguments
from ambiguous import decorator
@decorator
def power(fn, exponent=2):
'''take function results and raise to an exponent'''
return lambda x: fn(x) ** exponent
@power
def squared(x): return x
squared(2)
> 4
@power(exponent=3)
def cubed(x): return x
cubed(2)
> 8
thing_or_things: combine gets and multigets
from ambiguous import thing_or_things
@thing_or_things
def itself(args):
return { x : x for x in args }
itself(1)
> 1
itself([1, 2])
> { 1 : 1, 2 : 2 }
# specify which argument
@thing_or_things('args')
def prefix(prefix, args):
return { x : "%s_%s" % (prefix, x) for x in args }
prefix('abc', [1, 2])
> { 1 : 'abc_1', 2 : 'abc_2' }
optional parentheses (warning: still experimental)
import ambiguous
@ambiguous
def foo():
return 'foo'
# the usual
foo()
> 'foo'
# ?!?
foo
> 'foo'
foo + 'abc'
> 'fooabc'
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ambiguous-0.5.1.tar.gz
(11.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ambiguous-0.5.1.tar.gz.
File metadata
- Download URL: ambiguous-0.5.1.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ecd2957458fcfc7be224cfdd59795033b23c8c6a2a6e79f8059feb093f23034
|
|
| MD5 |
d42dda661bc9b2fe3ab15b39d8ecdbe0
|
|
| BLAKE2b-256 |
4184aa41d8cb65644eacb88e6eb289e6aefd59cf861b6b26b859a5da89080270
|
Provenance
The following attestation bundles were made for ambiguous-0.5.1.tar.gz:
Publisher:
pypi.yml on dpep/py_ambiguous
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ambiguous-0.5.1.tar.gz -
Subject digest:
8ecd2957458fcfc7be224cfdd59795033b23c8c6a2a6e79f8059feb093f23034 - Sigstore transparency entry: 1807619174
- Sigstore integration time:
-
Permalink:
dpep/py_ambiguous@6f304fbc2832d389c44f72f3b15ae50c862e62df -
Branch / Tag:
refs/tags/0.5.1 - Owner: https://github.com/dpep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@6f304fbc2832d389c44f72f3b15ae50c862e62df -
Trigger Event:
push
-
Statement type:
File details
Details for the file ambiguous-0.5.1-py3-none-any.whl.
File metadata
- Download URL: ambiguous-0.5.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db38d0981afce5adda1a7eb2c944d5a03eae3090c72c845a395e78f4e53002be
|
|
| MD5 |
7badca53f2096786fcc6795d83565458
|
|
| BLAKE2b-256 |
650e89027d71b45a0d0fa60836e77d047ee2324c85cf1593cdca152bc0f60062
|
Provenance
The following attestation bundles were made for ambiguous-0.5.1-py3-none-any.whl:
Publisher:
pypi.yml on dpep/py_ambiguous
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ambiguous-0.5.1-py3-none-any.whl -
Subject digest:
db38d0981afce5adda1a7eb2c944d5a03eae3090c72c845a395e78f4e53002be - Sigstore transparency entry: 1807619189
- Sigstore integration time:
-
Permalink:
dpep/py_ambiguous@6f304fbc2832d389c44f72f3b15ae50c862e62df -
Branch / Tag:
refs/tags/0.5.1 - Owner: https://github.com/dpep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@6f304fbc2832d389c44f72f3b15ae50c862e62df -
Trigger Event:
push
-
Statement type: