Let's allow `assert`s again
asserts in python are advertised as quick-and-easy checking tool to assert self-consistency within a program. They are used all over the place in the python eco-system and can help code be more readable (by making assumptions explicit) and avoid errors. The latter being the main reason for their existence.
asserts are also sometimes misused to validate user-input. This is bad because
asserts can be disabled via a python optimization flag. To error on the side of caution, we decided to ban the use of
asserts in NIFTy.
I would like to revert this decision. I think the two upsides already mentioned - improved readability and avoiding errors - far outweigh the potential harm (basically no one enables these python optimizations ). I use a lot of
asserts in my own code base and on multiple occasions had to remove asserts from code submitted to NIFTy to conform with this policy. In short: IMHO NIFTy does not get better by disallowing
@all What are you thoughts on this?
python -O enables basic optimization and removes all
asserts. With the
-O flag, python yields
.pyo files instead of
.pyc files. On my machine (with many, many python packages) not a single package installed a