Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Powerful Enumeration System

Project description

MakeObj is a module to help create powerful enumeration classes with support to attributes specific for each element.

This module is compatible with Python versions 2.6+ and 3.0+

Usage:

>>> from makeobj import Obj, keys, attr
>>> class RGBColors(Obj):
...     red, green, blue = keys(3)
...     hex = attr('ff0000', '00ff00', '0000ff')
...
>>> RGBColors
<Object: RGBColors -> [red:0, green:1, blue:2]>
>>> RGBColors.red
<Value: RGBColors.red = 0>
>>> RGBColors.blue.hex
'0000ff'

Using the custom Enum Language:

@obj RGBColors =:
    @keys = 'red', 'green', 'blue'
    @attr hex = 'ff0000', '00ff00', '0000ff'

Then you can parse it:

>>> from makeobj import parse
>>> RGBColors = parse(text)
>>> RGBColors.red
<Value: RGBColors.red = 0>

.

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 makeobj, version 0.8
Filename, size File type Python version Upload date Hashes
Filename, size makeobj-0.8.tar.gz (10.4 kB) File type Source Python version None Upload date Hashes View hashes
Filename, size makeobj-0.8.zip (13.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page