Skip to main content

Fancy `defer` for Python >= 3.12

Project description

Fancy defer for Python >= 3.12

Python package Coverage Status

Installation and usage

Installation

You may install deferrer by running pip install deferrer.

Usage

There are two designed ways to use defer. You may use either of them, or mix them up.

Sugarful

>>> from deferrer import defer

>>> def f():
...     defer and print(0)
...     defer and print(1)
...     print(2)
...     defer and print(3)
...     defer and print(4)

>>> import sys
>>> if sys.version_info < (3, 12):
...     from deferrer import defer_scope
...     f = defer_scope(f)

>>> f()
2
4
3
1
0

Sugarless

>>> from deferrer import defer

>>> def f():
...     defer(print)(0)
...     defer(print)(1)
...     print(2)
...     defer(print)(3)
...     defer(print)(4)

>>> import sys
>>> if sys.version_info < (3, 12):
...     from deferrer import defer_scope
...     f = defer_scope(f)

>>> f()
2
4
3
1
0

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

deferrer-0.2.9.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

deferrer-0.2.9-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file deferrer-0.2.9.tar.gz.

File metadata

  • Download URL: deferrer-0.2.9.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for deferrer-0.2.9.tar.gz
Algorithm Hash digest
SHA256 9e07c9b25c691c8e0c5e3ebe9f36c914691789d981317df9e0c82dd1029958f5
MD5 7a0c7dece951de263e84bcb84e62c480
BLAKE2b-256 46309e7af79dcb03e3589f129126e359864f54aa8a2c786dc6d570140bb58f95

See more details on using hashes here.

File details

Details for the file deferrer-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: deferrer-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for deferrer-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b52c5ddb6894aa283974b97590c6c2c2e40dfa53f724a60c0e63f50a9a132c66
MD5 1755695eb5e8560153ce643231d82b28
BLAKE2b-256 126ab45c0d7483251876f2e61047c823455a5498e23d9f74231cb0ca7f0cc252

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page