I love assert
invalid at invalid.invalid
Wed Nov 12 15:10:10 CET 2014
On 2014-11-12, Ben Finney <ben+python at benfinney.id.au> wrote:
> Chris Angelico <rosuav at gmail.com> writes:
>> On Wed, Nov 12, 2014 at 7:03 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
>> > An ‘assert’ statement in the code will sometimes be active, and
>> > sometimes be a no-op, for *exactly* the same code under different
>> > circumstances. That's a trap for the reader, and I'd rather not set
>> > it.
>> This is no worse than other forms of preprocessor magic.
> That other languages do it doesn't argue in favour of it. It argues,
> rather, that we should be glad not to have it in our Python code.
Technically it's not an argument for assert, but I think it is a
refutation of one of your arguments against assert. It refutes your
statement that the fact that asserts may not always be active is a
suprise to people and therefore acts as a "trap".
Grant Edwards grant.b.edwards Yow! Is it clean in other
More information about the Python-list