Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


I agree - especially when you're returning a list index, since `[-1]` is a valid index in Python.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: