sentinel¶
basedpython adds a sentinel statement for declaring named sentinel objects:
transpiles to:
syntax¶
sentinel NAME declares a module-level sentinel. the form is a soft keyword
followed by a single identifier and a newline. the identifier becomes the
sentinel name (used both as the python variable and as the string passed to
sentinel(...))
scope¶
sentinel is a soft keyword: in any other position (sentinel = 5,
sentinel(...)) it parses as a regular identifier
polyfill¶
PEP 661 proposes a builtin sentinel
function. until python ships it, typing_extensions.Sentinel is used