Access intrinsic operators through a lookup dict
More information: https://docs.python.org/3/library/operator.html
from operatorlookup import doops
print('-------------------------')
print(doops("==", 10, 20))
print(doops("+", 10, 20))
print(doops("-", 10, 20))
print('-------------------------')
defli = list(range(10))
print(defli)
_ = [(doops("=", defli, x, x * 10)) for x in range(10)]
print(defli)
print('-------------------------')
defli = list(range(10))
print(defli)
_ = [(doops("del", defli, 0)) for x in range(10) if x > 5]
print(defli)
print('-------------------------')
defli = {}
print(defli)
_ = [(doops("=", defli, x,x*100)) for x in range(10) if x > 5]
print(defli)
print('-------------------------')
getitemsresult = [(doops("[]", defli, x)) for x in range(10) if x > 5]
print(getitemsresult)
False
30
-10
-------------------------
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
-------------------------
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[4, 5, 6, 7, 8, 9]
-------------------------
{}
{6: 600, 7: 700, 8: 800, 9: 900}
-------------------------
[600, 700, 800, 900]
# All operations:
from operatorlookup import opdict
print(opdict)
{'+': <function _operator.add(a, b, /)>,
'concat': <function _operator.concat(a, b, /)>,
'in': <function _operator.contains(a, b, /)>,
'/': <function _operator.truediv(a, b, /)>,
'//': <function _operator.floordiv(a, b, /)>,
'&': <function _operator.and_(a, b, /)>,
'^': <function _operator.xor(a, b, /)>,
'~': <function _operator.invert(a, /)>,
'|': <function _operator.or_(a, b, /)>,
'**': <function _operator.pow(a, b, /)>,
'is': <function _operator.is_(a, b, /)>,
'is not': <function _operator.is_not(a, b, /)>,
'=': <function _operator.setitem(a, b, c, /)>,
'del': <function _operator.delitem(a, b, /)>,
'[]': <function _operator.getitem(a, b, /)>,
'<<': <function _operator.lshift(a, b, /)>,
'%': <function _operator.mod(a, b, /)>,
'*': <function _operator.mul(a, b, /)>,
'@': <function _operator.matmul(a, b, /)>,
'neg': <function _operator.neg(a, /)>,
'not': <function _operator.not_(a, /)>,
'pos': <function _operator.pos(a, /)>,
'>>': <function _operator.rshift(a, b, /)>,
'-': <function _operator.sub(a, b, /)>,
'truth': <function _operator.truth(a, /)>,
'<': <function _operator.lt(a, b, /)>,
'<=': <function _operator.le(a, b, /)>,
'==': <function _operator.eq(a, b, /)>,
'!=': <function _operator.ne(a, b, /)>,
'>=': <function _operator.ge(a, b, /)>,
'>': <function _operator.gt(a, b, /)>,
'+=': <function _operator.iadd(a, b, /)>,
'&=': <function _operator.iand(a, b, /)>,
'iconcat': <function _operator.iconcat(a, b, /)>,
'//=': <function _operator.ifloordiv(a, b, /)>,
'<<=': <function _operator.ilshift(a, b, /)>,
'%=': <function _operator.imod(a, b, /)>,
'*=': <function _operator.imul(a, b, /)>,
'@=': <function _operator.imatmul(a, b, /)>,
'|=': <function _operator.ior(a, b, /)>,
'**=': <function _operator.ipow(a, b, /)>,
'>>=': <function _operator.irshift(a, b, /)>,
'-=': <function _operator.isub(a, b, /)>,
'/=': <function _operator.itruediv(a, b, /)>,
'^=': <function _operator.ixor(a, b, /)>}
Metadata
Release files for operatorlookup 0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| operatorlookup-0.10.tar.gz | 4.3 kB | Without provenance | Details for operatorlookup-0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| operatorlookup-0.10-py3-none-any.whl | Python 3 | none | any | Details for operatorlookup-0.10-py3-none-any.whl |
Total release size: 10.0 kB
Release files / operatorlookup-0.10.tar.gz
| Download URL | operatorlookup-0.10.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f895aa37353f6c8edcf1bd0590f94fc62cb2cd9170235849fc5b5ecbbba1031
|
|
BLAKE2b-256 checksum How to use checksums |
3a59671e7dff9ef1d0817a1f5c9ef49bf15bddaa25361b48fdd946e4a39f023a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / operatorlookup-0.10-py3-none-any.whl
| Download URL | operatorlookup-0.10-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00eacd8e8d3e7d14dbb1b196764a6ed55b20e04e769ffec7c80309012fa52e6a
|
|
BLAKE2b-256 checksum How to use checksums |
c8304fe95174ee0e76c6613978cde9d8b67669a6ebe1176cc18054f7c84f8e1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for operatorlookup 0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.