https://github.com/cadojo/block-scopes
Block scoping in Python!
https://github.com/cadojo/block-scopes
Last synced: 3 months ago
JSON representation
Block scoping in Python!
- Host: GitHub
- URL: https://github.com/cadojo/block-scopes
- Owner: cadojo
- License: mit
- Created: 2022-10-28T05:07:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-21T21:49:24.000Z (over 2 years ago)
- Last Synced: 2025-02-17T02:03:42.359Z (3 months ago)
- Language: Python
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🩺 `block-scopes`
_Block scoping in Python!_[](https://pypi.org/project/block-scopes)
[](https://pypi.org/project/block-scopes)-----
**Table of Contents**
- [Usage](#usage)
- [Installation](#installation)
- [License](#license)## Usage
```python
from scopes import scopebefore = "I'll be kept!"
with scope("keep_me", "keep_me_too"):
keep_me = "Keep me!"
lose_me = "Not me!"keep_me_too = "Also... me!"
assert "before" in locals()
assert "keep_me" in locals()
assert "keep_me_too" in locals()assert "lose_me" not in locals()
```## Installation
```console
pip install block-scopes
```## License
`block-scopes` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.