Hacker News new | comments | show | ask | jobs | submit login

Just because you happen to like a particular coding technique doesn't mean its a good one, or that the developers are obliged to support you in it. For example, my preference could be to use all one character variables, because I can remember them all just fine, and they make my typing faster. However, this is obviously not a good habit, and hurts the comprehension of any other programmers that try to read my code. Or I could be addicted to using __add__ to call functions on my objects, with a hack that turns `my_object +"user"` into calling the user function on my_object. I could find this preferable to my_object.user() because it looks better, but that in no way entitles me to complain when a library calls + on a list-like object I passed it and it errors out, because I broke the contract of __add__. Python provides `assert` for a specific purpose, basically those outlined in the blog post, and using it for other things is just plain hackish, and is in no way a good practice.



assert is both easy to write and read. that's why people use it. the people who made it debug only were stupid.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: