3 ms·
It's a common standard for UNIX environment variables to be treated this way, and it greatly simplifies the logic needed to handle the value. Here's how this ca
by ericpruitt 3y ago
It's a common standard for UNIX environment variables to be treated this way, and it greatly simplifies the logic needed to handle the value. Here's how this can be simply implemented in Python:
if os.environ.get("NO_COLORS"): ...
In POSIX shell:
if [ "$NO_COLORS" ]; ...
or, when nounset is used:
if [ "${NO_COLORS:-}" ]; ...
Adding sentinel values when you only need a true/false indicator just complicates things.