[Python-Dev] Re: Why do binary arithmetic operators care about differing method implementations but rich comparisons don't?

2020-09-28 Thread Eric Wieser
Since I don't see it linked anywhere here: this was discussed a few years ago at https://bugs.python.org/issue30140. Eric ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.pytho

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Eric Wieser
As a tangential follow-up to my thought that _"the `:=` walrus operator seems to be usable as a substitute for new syntax"_, you can actually build a seemingly complete (if somewhat error-prone) _run-time_ pattern matching API using it: https://gist.github.com/e

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Eric Wieser
: > On Wed, Jun 24, 2020 at 5:23 AM Eric Wieser > wrote: > >> In regards to >> https://www.python.org/dev/peps/pep-0622/#alternatives-for-constant-value-pattern, >> was this alternative considered? >> ``` >> match obj: >> case SomeClass(field

[Python-Dev] Re: PEP 622: Structural Pattern Matching

2020-06-24 Thread Eric Wieser
A cursory search of this thread suggests that no one has mentioned this yet, but apologies if I missed one of the existing replies about this. In regards to https://www.python.org/dev/peps/pep-0622/#alternatives-for-constant-value-pattern, was this alternative considered? ``` match obj: cas

[Python-Dev] Re: Are extension types allowed to implement both nb_add and sq_concat?

2020-06-12 Thread Eric Wieser
efine new methods with more > discoverable names. > > On Fri, Jun 12, 2020 at 7:29 AM Eric Wieser > wrote: > >> Hi all, >> >> In the `operator` module, both `operator.concat` and `operator.add` are >> described as performing `a + b`. >> When defining a

[Python-Dev] Are extension types allowed to implement both nb_add and sq_concat?

2020-06-12 Thread Eric Wieser
ure. `__concat__` should be added as a slot_wrapper around `sq_concat` to allow the language feature to be accessed without writing C extensions. Eric Wieser Apologies if this is not the right list - this didn't feel right for python-ideas or bpo. I'm more than happy to repost this else

[Python-Dev] Fixing the ctypes implementation of the PEP3118 buffer interface

2019-04-14 Thread Eric Wieser
I've recently been adding better support to Numpy 1.16 for interoperability with ctypes. In doing so, I came across two bugs in the implementation of the PEP3118 buffer interface within ctypes, affecting `Structure`s and arrays. Rather than repeating the issue summaries here, I've linked their tra