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 hashes)

Uploaded Source

Built Distribution

simple_namespace-1.0.0-py3-none-any.whl (2.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