Python has the "star" ("*") operator for multiplication. In the context of
collections it is supposed to mean element-wise multiplication. Its associated
operator is __mul__. It also has the double star ("**") operator for
exponentiation, which is repeated multiplication. Its associated
ddle of
code is silently ignored, but I don't think anybody seriously relies on
that behavior.
haael
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3
NotImplemented
This would be somewhat analogous to `else if` blocks.
This pattern is very common in operator implementations. And this
proposal could simplify it a bit.
haael
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send
he class...
>
> Apologies if I'm misunderstanding your point here, but it feels like
> what you're proposing would only work if you pickled and unpickled the
> data in the *same* running instance of the program.
>
> Paul
>
On Thu, 3 Sep 2020 at 18:06, haael wrote:
Only obj
Only objects of globally defined classes are picklable:
class Global:
pass
picklable = Global()
def f():
class Local:
pass
return Local
Local_here = f()
unpicklable = Local_here()
However, instances become picklable if we assign the
Forgive me if this has already been discussed.
Could we add the idea of "negative" sets to Python? That means sets that
contain EVERYTHING EXCEPT certain elements.
First, let's have a universal set that contains everything.
assert element in set.UNIVERSAL
The universal set is a
f 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.
On 11/04/20 10:20 am, haael wrote:
.
To specify invariants on `while` loops we could do something like:
while loop_invariant(condition) and running:
loop_body
so no new syntax is needed.
With this syntax, annotatin loops with invariants would be possible
without changing indentation.
haael
Hello Everyone
s none to hint loops.
haael
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 &
I am developing a library for formal proofs and such a feature would be
handy.
haael
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/pyt
How about doing it pythonic way then, "everything is a hack on a symbol
table".
Let normal loops remain normal loops.
Let's introduce a special construction:
> for x in iterator as loop_control_object:
> loop_body(loop_control_object)
The iterator in the loop would be wrapped inside
The concrete example I was working on when I started to miss double
break. This is an implementation of polynomial long division in Galois
field. Almost unmodified.
With outer break, I would't need to use the `running` variable. In fact,
for mathematical clarity, I would like to put a
Python allows for breaking out from a loop through 'break' and
'continue' keywords. It would be nice if it was possible to break many
loop levels using one command.
I propose two constructions for that:
break
break break
break break break
...
continue
break continue
break break continue
13 matches
Mail list logo