/konst

Effortless, meaningless, DRY constants

Primary LanguagePythonMIT LicenseMIT

konst

https://travis-ci.com/yehonatanz/konst.svg?branch=master Maintainability

Effortless, meaningless, DRY constants

from konst.string import RED
from konst.symbol import FLOWER

assert RED == 'RED'
assert FLOWER.name == 'FLOWER'

This module supplies dynamic, created-on-import constants without the need for this annoying duplication:

CONSTANT_NAME = 'CONSTANT_NAME'

Supports both string and symbolic constants (immutable, interned objects with no meaning beyond their name and identity).

TODO:
Integer constants - will be supported once I'll figure a method to give them reproducible values