On 13/11/14 10:05, Ian Kelly wrote:
On Wed, Nov 12, 2014 at 3:47 PM, Marko Rauhamaa <ma...@pacujo.net> wrote:
Ian Kelly <ian.g.ke...@gmail.com>:

Apart from idiomatic style, there is no difference between

     # never reached

     assert False

     raise RuntimeError('Unreachable code reached')

If the purpose is communication, then the comment is most effective,
as it can easily convey anything you want. If the purpose is to detect
programming errors, then the RuntimeError is most effective, as it
will always raise an error in the event it is reached.

assert False is a strange hybrid of the two that is less effective at
both purposes.


You can do;

    assert False, "Some comments about why this assert is here"



--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to