Proposed new conditional operator: "or else"
Ethan Furman
ethan at stoneleaf.us
Tue Dec 2 13:06:29 EST 2014
On 12/02/2014 09:41 AM, Zachary Ware wrote:
> On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote:
>>
>> Wouldn’t it be neat to write:
>>
>> foo == 42 or else
>>
>> and have that be an synonym for:
>>
>> assert foo == 42
>
> Never going to happen, but I like it! Perhaps raise IntimidationError
> instead of AssertionError when it fails?
As long as when raising Intimidation, it also roughs up a couple surrounding lines as a warning to the rest of the code...
--
~Ethan~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20141202/6c486da3/attachment.sig>
More information about the Python-list
mailing list