[Python-ideas] Repurpose `assert' into a general-purpose check
Ethan Furman
ethan at stoneleaf.us
Thu Jan 18 02:12:53 EST 2018
On 01/17/2018 10:59 PM, Steven D'Aprano wrote:
> On Thu, Jan 18, 2018 at 05:22:06PM +1100, Chris Angelico wrote:
>
>> I haven't yet seen any justification for syntax here. The nearest I've
>> seen is that this "ensure" action is more like:
>>
>> try:
>> cond = x >= 0
>> except BaseException:
>> raise AssertionError("x must be positive")
>> else:
>> if not cond:
>> raise AssertionError("x must be positive")
>>
>> Which, IMO, is a bad idea, and I'm not sure anyone was actually
>> advocating it anyway.
>
> My understanding is that Sylvain was advocating for that.
Agreed. Which, as has been pointed out, is an incredibly bad idea.
--
~Ethan~
More information about the Python-ideas
mailing list