Skip to main content

Block scopes in Python? Whaaaaaat?!

Project description

🩺 block-scopes

Block scoping in Python!

PyPI - Version PyPI - Python Version


Table of Contents

Usage

from scopes import scope

before = "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

pip install block-scopes

License

block-scopes is distributed under the terms of the MIT license.

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

block_scopes-0.2.3.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

block_scopes-0.2.3-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

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