3 ms·
Sounds broken by spec without a false/disable value or values defined. It says to always assume true for any non-empty string, which would include things like "
by jsd1982 3y ago
Sounds broken by spec without a false/disable value or values defined. It says to always assume true for any non-empty string, which would include things like "no", "off", "false", "0", etc.
- ericpruitt 3y agoIt'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.