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.

Files for superglobals, version 0.0.15
Filename, size File type Python version Upload date Hashes
Filename, size superglobals-0.0.15.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page