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.
Source Distributions
makeobj-0.8.zip
(13.5 kB
view details)
makeobj-0.8.tar.gz
(10.4 kB
view details)
File details
Details for the file makeobj-0.8.zip
.
File metadata
- Download URL: makeobj-0.8.zip
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f691782474c1d927757557ecd1ca905fa731d2d09dfb81d617017dac9acb0df8 |
|
MD5 | 90ab7039bb940c81b3cbb3b877253aa0 |
|
BLAKE2b-256 | 49a17ff1bdc5bface417918ca62b0b415a44dc671b609392a92c8b75a4f37ed9 |
File details
Details for the file makeobj-0.8.tar.gz
.
File metadata
- Download URL: makeobj-0.8.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81e466c97654df1c3c51d880b3b9b3612ad2c938a945435d9ce2b344f10e70cf |
|
MD5 | 3dfde560a7f1088a324dfb0110c007f1 |
|
BLAKE2b-256 | ca17b1024ce6f22039c0c87bf419985f0cf5d2a1af9460fa785066fe6a71f708 |