News for hackers. Stuff that matters.
Re:Binary Search Reconsidered (2018) by justinpombrio on Friday December 25, 2020 @10:49PM (#25541231)
> A more useful signature would have been [returning the index].

Good point! And if you're doing that, there's no reason to use slices. So I guess the only thing to learn from my code... is that slices do useful bookkeeping for problems similar to this, in the case that you don't care about the indices?

> Returning the value you were given or None would be better expressed as returning True/False to avoid the unnecessary copy.

Just because two values are equal, doesn't mean they're the same. Though my function signature was wonky, regardless.

There are no comments on this comment yet.