On Sat, Sep 11, 2021 at 02:30:10PM -0400, Juancarlo Añez wrote:
> *invariant* cond: etc
A software invariant is still an assertion.
In another post, I semi-suggested a new (soft) keyword:
unless condition:
# block
raise Exception
But really, it's just an "if not".
if not condition:
unless condition:
assert condition:
are all exactly the same amount of typing. It's not clear that learning
a new keyword `unless` is more readable than just using `if not`.
I think it might work better in languages that attempt to follow natural
language (e.g. XTalk languages) than one like Python with a relatively
minimal amount of syntax. But it is clear to me that using `assert` for
non-assertions is misleading.
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/ERBJUTXNAVALGUGDPC7EHQT3LUP3NQHB/
Code of Conduct: http://python.org/psf/codeofconduct/