No project description provided
Project description
use-context
use some vars in current context and try rollback state when exit the context.
Usage
By default:
from use_context import use
ls = [1, 2, 3]
with use(ls):
ls.append(5)
assert ls == [1, 2, 3]
For use ref (by name):
a = 15
with use(refs=['a']) as ctx:
assert not ctx.is_ref_changed('a')
a = 16
assert a == 16
assert ctx.is_ref_changed('a')
assert a == 15
👍
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
use_context-0.0.3.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for use_context-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a90be319aade88d4b50e08718360f4ea88377aad40c5eb902c25fbdb989221ce |
|
MD5 | 544dd24dbdf86d1bd3bcd7616dd246c0 |
|
BLAKE2b-256 | 2be5d2016de9bcd7b9da0faf7afcc28c2683845d3928c0af4583f43ab9d20de0 |