3 ms·
I get what you're saying, but even when sentinels are used inside a function, returning a -1 to the caller seems like a pretty bad API. It's OK to raise ValueEr
by jessaustin 12y ago
I get what you're saying, but even when sentinels are used inside a function, returning a -1 to the caller seems like a pretty bad API. It's OK to raise ValueError! I had thought the idiomatic sentinel value was an instance of object() you could is against, anyway.
- LyndsySimon 12y agoI agree - especially when you're returning a list index, since `[-1]` is a valid index in Python.