Fancy `defer` in python 3.12
Project description
Fancy defer
in Python 3.12
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
Release history Release notifications | RSS feed
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.3.tar.gz
(10.7 kB
view hashes)
Built Distribution
deferrer-0.2.3-py3-none-any.whl
(11.3 kB
view hashes)