[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Matsuoka Takuo
On Wed, 13 Apr 2022 at 15:02, Ganesh B wrote: > > I hope nicer on the code text please. Sure. Sorry about that. malmiteria's "lib" code is ``` class HighGobelin: def scream(self): print("raAaaaAar") class CorruptedGobelin(HighGobelin): def scream(self): print("my

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Matsuoka Takuo
On Wed, 13 Apr 2022 at 04:28, malmiteria wrote: > > Idk, what do you think? I would need to see more examples to determine the limit of the current strategy for method resolution and super. For the example at hand, I can be happy with the following code as a lib user (using your lib code). ```

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Eric V. Smith
On 4/12/2022 12:57 PM, malmiteria wrote: So the amount of actual breakings left shouldn't be enough to justify denying this feature IMO. Again, we'll have a clearer view on that once we get experimental data. What's to look for is usage of super in MI cases, since each super call in MI today

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread David Mertz, Ph.D.
On Tue, Apr 12, 2022, 4:31 PM Steven D'Aprano > Except the most important one: why are you using multiple inheritence when > you clearly don't want multiple inheritence, instead you want delegation? > I'll note that hundreds of posts ago, I made the FIRST reply to this silliness, and that it

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Brendan Barnwell
On 2022-04-12 11:02, malmiteria wrote: My proposal would completely detach method resolution from calls to super. essentially: ``` class A: val = 1 class B: val = 2 class C(A,B): pass C.val # raises an explicitness required error ``` If you think you can come up with code that

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Steven D'Aprano
On Tue, Apr 12, 2022 at 11:17:27AM -, malmiteria wrote: > Steven D'Aprano writes: > > > So in the general case, order matters. We have to linearize the > > superclasses, and call them in that linear order, and the best way to do > > that is with the MRO and super. > Why would we *have* to

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread malmiteria
Eric V. Smith writes: > I've said this before, but I'll repeat it here: if your proposal is to > have super().something raise an error if "something" exists on more than > one parent class (via the MRO), then that's a breaking change and it > will not be accepted. The expliciteness required

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Joao S. O. Bueno
On Tue, Apr 12, 2022 at 1:59 PM malmiteria wrote: > Ronald Oussoren writes: > > > To be blunt: That’s not going to happen because this is big backward > compatibility break. Either that, or this adds a > > second way to define classes. Both are good reasons to keep the status > quo. > > the

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Chris Angelico
A general note on breaking changes: On Wed, 13 Apr 2022 at 03:01, malmiteria wrote: > > Ronald Oussoren writes: > > > To be blunt: That’s not going to happen because this is big backward > > compatibility break. Either that, or this adds a > > second way to define classes. Both are good

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread malmiteria
Matsuoka Takuo writes: > I don't think this is better than the failing code in any way. It > will fail in the same way. Yeah! i completely forgot that :p I've been redoing this exemple so many times now, it's hard to always keep the brain turned on when writing it. Thanks for pointing it out.

[Python-ideas] Re: Native support for units

2022-04-12 Thread Ethan Furman
On 4/12/22 00:57, Stephen J. Turnbull wrote: Ethan Furman writes: 15mpg * 7l == how many miles? Now it's my turn to not understand the point of this example. My point is that when an object is instantiated it can normalize its arguments, and that that normalization should happen with

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread malmiteria
Ronald Oussoren writes: > To be blunt: That’s not going to happen because this is big backward > compatibility break. Either that, or this adds a > second way to define classes. Both are good reasons to keep the status quo. the breaking is limited MI with name collision, so likely rare

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Matsuoka Takuo
On Wed, 13 Apr 2022 at 02:00, Matsuoka Takuo wrote: > > Thanks for your answer. > > On Mon, 11 Apr 2022 at 00:46, malmiteria wrote: > > > > There's a few problems, mainly, if you provide ProudGobelin and > > CorruptedGobelin as a lib author, you're very likely not to think of the > > HalfBreed

[Python-ideas] Re: Native support for units [was: custom literals]

2022-04-12 Thread Ricky Teachey
On Tue, Apr 12, 2022 at 11:27 AM Christopher Barker wrote: > > > I guess you could call the associative law of multiplication "dumb >> > > luck", but most mathematicians will consider that hate speech. >> > >> > My apologies for not understanding your example. The counter >> > example I

[Python-ideas] Re: Native support for units [was: custom literals]

2022-04-12 Thread Christopher Barker
> > > > I guess you could call the associative law of multiplication "dumb > > > luck", but most mathematicians will consider that hate speech. > > > > My apologies for not understanding your example. The counter > > example I had in my head, and should have written down, > > was something

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Eric V. Smith
On 4/12/2022 7:43 AM, malmiteria wrote: Brendan Barnwell writes: You seem to be envisioning a system in which multiple inheritance gives a subclass a "menu" of behaviors from which it may explicitly choose, but does not actually combine the superclasses' behaviors into a single, definite

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Ronald Oussoren via Python-ideas
> On 12 Apr 2022, at 13:17, malmiteria wrote: > > Steven D'Aprano writes: > >> So in the general case, order matters. We have to linearize the >> superclasses, and call them in that linear order, and the best way to do >> that is with the MRO and super. > Why would we *have* to do that? >

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread Matsuoka Takuo
Thanks for your answer. On Mon, 11 Apr 2022 at 00:46, malmiteria wrote: > > There's a few problems, mainly, if you provide ProudGobelin and > CorruptedGobelin as a lib author, you're very likely not to think of the > HalfBreed use case, so the lib users wanting to create the HalfBreed class is

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread malmiteria
Steven D'Aprano writes: > Do you think that the order of arguments in func(a, b) doesn't matter? Actually it doesn't: ``` def func(a, b): print(a) print(b) func(b=10, a=5) ``` would print 5, then 10 But i get what you mean, and i know very much it matters here. > One of the reasons why

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread malmiteria
Brendan Barnwell writes: > You seem to be envisioning a system in which multiple inheritance > gives a subclass a "menu" of behaviors from which it may explicitly choose, > but does not actually combine the superclasses' behaviors into a single, > definite behavior of the subclass. In that

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread malmiteria
Steven D'Aprano writes: > So in the general case, order matters. We have to linearize the > superclasses, and call them in that linear order, and the best way to do > that is with the MRO and super. Why would we *have* to do that? When multiple parent provide candidate to a method resolution,

[Python-ideas] Re: mro and super don't feel so pythonic

2022-04-12 Thread malmiteria
Steven D'Aprano writes: > In any case, how do you know what "most people" think? Have you done a > survey, or are you just guessing? I haven't done a survey, but I'm getting one ready, I also wanna let you all have a read at it before running it, so we can all agree the data we would get from

[Python-ideas] Re: Custom literals, a la C++

2022-04-12 Thread Christopher Barker
On Mon, Apr 11, 2022 at 12:22 PM Chris Angelico wrote: > > as oped what I understand was being proposed via a "global registry", > which is that code: > > > > distance = 500[miles] > > > > would work even if there were no name "miles" in that namespace(s) -- > and it would, instead go look for

[Python-ideas] Re: Native support for units [was: custom literals]

2022-04-12 Thread Stephen J. Turnbull
Ethan Furman writes: > On 4/10/22 21:33, Stephen J. Turnbull wrote: > > > I guess you could call the associative law of multiplication "dumb > > luck", but most mathematicians will consider that hate speech. > > My apologies for not understanding your example. The counter > example I had