Skip to main content

stringliteral

Project description

Code style: black

stringliteral

from stringliteral import StringLiteral

class AllowedValues(StringLiteral):
    LEFT="left"
    RIGHT="right"

value = AllowedValues.LEFT

AllowedValues.contains("left") # returns True
AllowedValues.contains("up") # returns False

Define your class attributes with ALL CAPS only. Non CAP attributes will be ignored.

I created this for my own usage after tripping over using the built in Enum class many, many times..

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

stringliteral-0.0.1.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

stringliteral-0.0.1-py3-none-any.whl (1.9 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