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

>> and (the worst case) basic control flow. I call it "java-way goto"

I can't agree about Class.objects.get - method must return exactly one row by known pk value.

So it perfectly sane to raise exception for zero rows.

Class.objects.filter is working the way you want.




Except that get accepts as parameters non-unique non-primary fields too.

I have every reason to believe that the Django devs are capable people who thought about this and landed on this specific usage with a clear rationale... but it still is a misuse of error handling capabilities of a language. And a sort of misuse that everyone else does sometimes as well.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: