I'd have to agree with Steven here, I'm -0 on the proposal since it's not
convincing (at least at the moment).
haael wrote:
> Python has more and more optional tools for formal correctness cheking.
> Why not loop invariants?
A better question would be "why add loop invariants?" rather than "why n
haael writes:
> Loop invariant is such a statement that if it was true before the loop
> iteration, it will also be true after the iteration. It can be
> implemented as an assertion of an implication.
>
> now_value = False
> while running_condition(...):
> prev_value =
I am making a library that is able to prove that a function (without
side effects) is correct for every input, without explicitly calling it
on every input. It's quite similar to what Klee does to LLVM programs.
https://klee.github.io/
Klee (and my solution too) works by unrolling loops. Tha
Consider that the start or end of a string may contain repetitions of an
affix.
Should `-+-+-+Spam'.stripprefix('-+') remove just the first occurence?
All of them? Does it need a 'count' parameter?
[all modulo bikeshedding on the names of course]
Rob Cliffe
__
Just the first occurrence. The vast majority of the time, that's what
people want to do, and they will usually forget to add a 'count' parameter.
Many people probably wouldn't even know it exists. It would be disastrous
if code did the correct thing 99.9% of the time but occasionally silently
mutil
str.replace is in the opposite situation:
1. People usually want to replace everything. When I search for uses of
replace in code, I can't find any uses of the count parameter.
2. People are more likely to accidentally notice that everything is
being replaced the string being replaced
> On 18 Mar 2020, at 18:03, Rob Cliffe via Python-ideas
> wrote:
>
> Consider that the start or end of a string may contain repetitions of an
> affix.
>
> Should `-+-+-+Spam'.stripprefix('-+') remove just the first occurence? All
> of them? Does it need a 'count' parameter?
The only wa
> On Mar 18, 2020, at 04:22, haael wrote:
>
> What is bugging me is the assymetry: there is a nice way to hint functions,
> but there is none to hint loops.
Then Steve’s suggestion of a context manager seems perfect. It allows you to
hint any statement, including a loop statement, by adding wh