It's nothing to do with Python, really.
'assert' really is a debugging tool that forces an exception and/or a core dump on a bug condition.
It is standard practice to have assertions in debug builds removed in release builds.
Code should not use assertions to detect error cases but only bugs (i.e. conditions which should never be true whatever happens).
In the code discussed here they are using 'assert' to check a password, which is simply bad design.
It's perfectly fine to use 'assert' in Python for what it is for.