Skip to main content

# AutoStrEnum

Project description

AutoStrEnum

This project defines an extended Enum class.
It can automatically assign the value to your Enum member, and the value is just the same as the member name!
And when you print it, you won't see the Enum name in front of the class member.

Install

pip install AutoStrEnum

Basic use

from enum import auto
from AutoStrEnum import AutoStrEnum

class Fruit(AutoStrEnum):
    BANANA = auto()
    WATERMELON = auto()
    DURIAN = auto()

if __name__ == '__main__':
    print(Fruit.BANANA, Fruit.WATERMELON, Fruit.DURIAN)
$ python demo.py
BANANA WATERMELON DURIAN

You can check all the example at demo.py

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

AutoStrEnum-0.0.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

AutoStrEnum-0.0.1-py2.py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 2 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