singletons.novalue

Pythonic FP - Collection of singleton classes

class pythonic_fp.singletons.novalue.NoValue

Singleton class representing a missing value.

Similar to None but

  • while None represents “returned no values”

  • NoValue() represents the absence of a value

Usage:

  • import NoValue from pythonic-fp.singletons and then

    • either use NoValue() directly

    • or define _noValue: Final[NoValue] = NoValue() don’t export it

  • compare using is and is not

    • not == or !=

    • None means returned no values, so None == None makes sense

    • if one or both values are missing, then what is there to compare?