Skip to main content

Organize code better with namespaces

Project description

What is this?

This is a very simple python tool for creating namespaces. It tries to solve the problem that there is no elegant way to create singleton classes or nested namespaces in python.

How do I use this?

pip install simple_namespace

from simple_namespace import namespace

@namespace
def MyNamespace():
    my_value = 10
    def my_function(arg1):
        return 99

    return locals()

# prints 10
print(MyNamespace.my_value) 

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

simple_namespace-1.0.0.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

simple_namespace-1.0.0-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file simple_namespace-1.0.0.tar.gz.

File metadata

  • Download URL: simple_namespace-1.0.0.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.6

File hashes

Hashes for simple_namespace-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e7e2ff6900b9809822623674fc1e45b46f1188ee3fde46330c381500420f8e9e
MD5 81ab862c12df741a3115ab70ec36beb8
BLAKE2b-256 eaf7488729ab4ea72e9587e2dfb4a50599851b7394cde4112a1906d4020ab374

See more details on using hashes here.

File details

Details for the file simple_namespace-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: simple_namespace-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.6

File hashes

Hashes for simple_namespace-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abbcb832ee44a6fbf4c0fa654388ad90d11297ab71b9d3d7bc4e2e882e57173f
MD5 db80dedd338567c545d884f0844318f2
BLAKE2b-256 bcd56e19f6464e76ce710106aa222500c82198b0a74113ab96dd68285afd8fd2

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