3 ms·
In C it's easy enough to define your own macro (I like to call it "require") which behaves similarly, but doesn't "abuse" assert. Not so in Python, though. It
by dilap 13y ago
In C it's easy enough to define your own macro (I like to call it "require") which behaves similarly, but doesn't "abuse" assert. Not so in Python, though.
It is silly to make the most, convenient form of error checking subtly wrong, and then castigate programmers as lazy for using it.
- penguindev 13y agoyeah, the problem is assert is already such a fine name. why, oh why, must it be confined to debug only builds :-(
- dilap 13y agowell it doesn't have to be, it's just a convention -- feel free to violate it, you just have to deal w/ your usage being a bit surprising, and lectures like the original blog post. :)