pydollar
About pydollar
pydollar is a Python module which enables a non-native syntax for the dollar sign $ in Python code. It allows you to follow the DRY-principle (don’t repeat yourself) more stricly when writing python code:
Take for example a file called mymodule.py:
from sympy import Symbol
def my_func():
alpha, beta, gamma, delta, epsilon = symbs = map(Symbol, $)
return symbs
we could then import from it by first intalling an import hook:
>>> import pydollar
>>> pydollar.install_import_hook()
>>> from mymodule import my_func
>>> from sympy import init_printing
>>> init_printing()
>>> my_func()
(α, β, γ, δ, ε)
Motivation
f-strings were a great additon to Python 3.6, the $ syntax follows it in spirit, it simply allows you to write succinct code.
If $ syntax (or more importantly, the functionality it provides) becomes official syntax there would be a real-world benefit to widely used codebases, e.g. SymPy:
https://github.com/sympy/sympy/blob/sympy-1.0/sympy/core/symbol.py#L587
Installation
Simplest way to install pydollar is to use pip:
$ python3 -m pip install --user pydollar
you can skip the --user flag if you have got root permissions.
Examples
See the test files under tests/.
License
The source code is Open Source and is released under the very permissive “simplified (2-clause) BSD license”. See LICENSE for further details.
Contributing
Contributors are welcome to suggest improvements at https://github.com/bjodah/pydollar
Metadata
Release files for pydollar 0.1.3
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 | |
|---|---|---|---|---|
| pydollar-0.1.3.tar.gz | 4.9 kB | Without provenance | Details |
Release files / pydollar-0.1.3.tar.gz
| Download URL | pydollar-0.1.3.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61c564bcb841cf2b24019901c93f411eaaea7ed688ff0e35c79fed9d9a5aa7bb
|
|
BLAKE2b-256 checksum How to use checksums |
9d409982679792ec220b21ba3bb1ac41421b3a62e41e4ef6b9d4ace447ab76b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pydollar 0.1.3
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.