Hello,
On Sat, 11 Apr 2020 10:24:33 +0100
haael <[email protected]> wrote:
> Give me a better one then.
>
> I need a way for quickly annotating loops with invariants. The
> problem with context managers is that it needs indentation change
> which is definitely not "quick".
Did you consider implementing (properly) "from __future__ import
braces"? It will allow you to write one-liners like:
for var in sth { if (cond) do_sth;
rest_of_code
}
>
> Imagine I wanted to take code from some public repo and add loop
> invariants to it. If the diff touches half of the lines of the code,
> it will never be merged.
>
> We can quickly annotate functions with decorators and type hints
> (both are one-liners).
>
> We can quickly specify assertions (one-liner).
>
> Now give me one-liner for loop invariants.
In diff format:
for var in sth:
+ invariant_comma_d_apostrophe_oh(var != kaboom)
rest_of_code
[]
--
Best regards,
Paul mailto:[email protected]
_______________________________________________
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/JUTYBTYWI6VHQHKAUJJNNKUPDBRDNPLK/
Code of Conduct: http://python.org/psf/codeofconduct/