On May 28, 2012, at 12:33 AM, Jakub Wilk wrote:

>It's a mistake to write
>
>      assert(tilsit, 'Never at the end of the week, sir.')
>
>instead of
>
>      assert tilsit, 'Never at the end of the week, sir.'
>
>The former assertion is always true, and thus no-op. Python >= 2.6 emits a
>SyntaxWarning about this.

Nice catch.  I've seen something similar quite often, but written correctly,
it's a good way to provide meaningful longer assertion messages, without any
ugly backslashes.  The *right* way to write this would be:

    assert tilsit, (
        'Never at the end of the week, sir.')

Cheers,
-Barry


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20120529112953.79e71...@resist.wooz.org

Reply via email to