Skip to main content

pydollar provides an installable import hook to support the dollar sign ($) as valid python syntax.

Project description Build status PyPI version Python version License

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

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()
(α, β, γ, δ, ε)


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:


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.


See the test files under tests/.


The source code is Open Source and is released under the very permissive “simplified (2-clause) BSD license”. See LICENSE for further details.


Contributors are welcome to suggest improvements at


Björn I. Dahlgren, contact:
  • gmail address: bjodah
  • address: bda

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

pydollar-0.1.3.tar.gz (4.9 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page