[Python-ideas] Double "at" operator for matmul exponentiation

2023-07-05 Thread haael
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

[Python-ideas] Make ellipsis an indicator of missing implementation

2023-04-27 Thread haael
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

[Python-ideas] except-try block

2020-10-11 Thread haael
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

[Python-ideas] Re: Pickle improvement: global qualnames for local classes

2020-09-04 Thread haael
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

[Python-ideas] Pickle improvement: global qualnames for local classes

2020-09-03 Thread haael
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

[Python-ideas] Universal set

2020-08-10 Thread haael
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

[Python-ideas] Re: RFC: For Loop Invariants

2020-04-11 Thread haael
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:

[Python-ideas] Re: RFC: For Loop Invariants

2020-04-10 Thread haael
. 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

[Python-ideas] Re: Syntax for loop invariants

2020-03-18 Thread haael
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 &

[Python-ideas] Syntax for loop invariants

2020-03-17 Thread haael
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

Re: [Python-ideas] Break multiple loop levels

2019-05-13 Thread haael
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

Re: [Python-ideas] Break multiple loop levels

2019-05-12 Thread haael
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-ideas] Break multiple loop levels

2019-05-11 Thread haael
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