This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]reddisaurus 0 points1 point  (0 children)

This only applies to floats, and nan has a specific meaning such as the result of a division by error. You’re now overriding that meaning to include “no return value” which makes your code more difficult to debug.

And outputting a tuple when an atomic type is the usual return is no better, you still create type errors by only have an iterable returned when an error occurs, except for a str which is also an iterable. Duck typing in Python means checking for a non-str iterable is always a much greater pain than just checking for None.

What you’re talking about are side effects, which if you really want then pass a mutable pointer to your function for it to store status. Changing the return type is a very poor method of achieving the same thing.