Skip to main content

globals() access anywhere. "We Do Anything, Anytime"

Project description

Easy access to globals() from inside a python module.

See: https://stackoverflow.com/questions/15959534/visibility-of-global-variables-in-imported-modules/69029612#69029612

Using superglobals

import superglobals

from superglobals import *

superglobals()[var] = value

setglobal('test', 123)
defaultglobal('test', 456)
assert(getglobal('test') == 123)

setglobal('a.b.c', 7)
> a['b']['c'] == 7

setglobal('a\.b\.c', 8)
> globals()['a.b.c'] == 8

Changelog

0.0.10: initial release (2021-09-02) 0.0.13: added dotted object heirachy expansion (2021-09-13)

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

superglobals-0.0.17.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file superglobals-0.0.17.tar.gz.

File metadata

  • Download URL: superglobals-0.0.17.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.9

File hashes

Hashes for superglobals-0.0.17.tar.gz
Algorithm Hash digest
SHA256 2c2326a1322d076efb2e4b5597ce24a3bbba2535f71fa953f6b4dc70ed9c2938
MD5 e202e25c830b6c13c630caab321bcd64
BLAKE2b-256 ea8a95870470da2e4ec4b041f9a3041c2a33e793f983a91368114c7bd4cfe48d

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