Hacker News new | ask | show | jobs
by athrowaway3z 1715 days ago
Before this thread i had no idea assert was debug only in python.

Another solution would be to accept the current role of assert as quick error checking and add in debug_assert to indicate a conditional error check. The biggest issue with that approach is that a majority will suddenly ask "Wait, python has a debug mode?"

1 comments

Not because the -o mode also remove any block testing on "__debug__", and that's a very useful thing as well.

The original feature is perfect. But there is 5 good years of educating users so it can be used.

I still do not understand what the problem is and what users need to know. So assert throws and exception in debug mode and is 'commented out' in production, right?

So the problem is some vendors ship libs that have failing asserts so cannot run in debug mode?