General Utils¶
UNDEFINED
¶
- djem.UNDEFINED¶
New in version 0.7.
The
UNDEFINED
constant is a falsey value designed for use in argument default values, for situations in which any value given (including traditional argument default values such asNone
) have an explicit meaning.from djem import UNDEFINED def make_thing(name, label=UNDEFINED): # None, the empty string, or False could indicate "no label" and need # to be distinguished from no value being provided if label is UNDEFINED: label = name ...
It can also be used in more generic conditional statements:
from djem import UNDEFINED value = UNDEFINED if value: print('truthy') else: print('falsey') # output: 'falsey'