On Fri, 27 Jan 2023 21:35:11 -0800 (PST), Grant Edwards wrote: > In Unix shells, a return code of 0 is true and non-0 is false.
That carries over to some C functions like strcmp() although it's more complex. strcmp() returns the value of subtracting the nth character of string b from string a if the value is not 0. For matching strings, the result is 0 for all character positions. This plays nicely with sorting functions but naive programmers assume it's a boolean and strcmp("foo", "foo") should return 1 or true when the strings match. Returning 0 for success gives you much more latitude in return values. -- https://mail.python.org/mailman/listinfo/python-list