On 2021-07-16 12:44, Stephen J. Turnbull wrote:
Thomas Grainger writes:
> Another example, is a cash point (ATM) won't give you your money
> until you take your card
That ATM is effective in enforcing the desired behavior. In Python
you would usually use an exception to force handling. Returning
status codes, or couples of status codes and values, isn't nearly as
effective.
And a (status, value) couple does nothing to encourage checking the
code over (value, status).
To me, it makes more sense to return (status, value) than (value,
status) because it's clearer to say "that didn't work, so you can just
ignore the value" than "here's a value, but it didn't work, so just
ignore the value even though I mentioned it first".
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/MUAGZXQ3A6CUHL5O6GSGHOECKIJVA2Q3/
Code of Conduct: http://python.org/psf/codeofconduct/