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

2022-04-10 Thread Stephen J. Turnbull
malmiteria writes: > You'd need to return A.bar in C bar methods to get more symmetry, > but what if you wanted foo to visit the inheritance tree in this > order? I don't want that, however. Please give up this notion that you can tell anybody else what they might want. You need to show

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

2022-04-10 Thread Christopher Barker
On Sun, Apr 10, 2022 at 7:25 PM Chris Angelico wrote: > > You might not be, but those of us who use it, or *would* use it if it > > wasn't so dangerous, think differently. > > Would you? What would the behaviour of os.chdir be if it had module > scope? Please explain, I am very curious. > I

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

2022-04-10 Thread Stephen J. Turnbull
Warning: serious linguistic hacking follows. I tried to be careful in writing, please be careful in reading. Corrections welcome. Ethan Furman writes: > On 4/9/22 21:17, Stephen J. Turnbull wrote: > > > if 12*u.mm * 42*u.MFr == 502*u.foo: > > print('Well done!') > > Part of

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

2022-04-10 Thread Chris Angelico
On Mon, 11 Apr 2022 at 10:41, Steven D'Aprano wrote: > > On Sat, Apr 09, 2022 at 02:52:50AM +1000, Chris Angelico wrote: > > > We aren't bothered by the fact that os.chdir() > > is global, we just accept that it belongs to the application, not a > > library. > > You might not be, but those of us

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

2022-04-10 Thread Steven D'Aprano
On Sat, Apr 09, 2022 at 02:52:50AM +1000, Chris Angelico wrote: > We aren't bothered by the fact that os.chdir() > is global, we just accept that it belongs to the application, not a > library. You might not be, but those of us who use it, or *would* use it if it wasn't so dangerous, think

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

2022-04-10 Thread Chris Angelico
On Mon, 11 Apr 2022 at 09:45, Ethan Furman wrote: > > On 4/10/22 14:09, Chris Angelico wrote: > > On Mon, 11 Apr 2022 at 06:48, Ethan Furman wrote: > >> > >> On 4/10/22 10:17, Chris Angelico wrote: > >>> On Mon, 11 Apr 2022 at 02:59, Christopher Barker wrote: > >> > But if I did that, then

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

2022-04-10 Thread Ethan Furman
On 4/10/22 14:09, Chris Angelico wrote: On Mon, 11 Apr 2022 at 06:48, Ethan Furman wrote: On 4/10/22 10:17, Chris Angelico wrote: On Mon, 11 Apr 2022 at 02:59, Christopher Barker wrote: But if I did that, then one lib registering my units with the global repository might break some other

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

2022-04-10 Thread Steven D'Aprano
On Sun, Apr 10, 2022 at 05:56:14PM -, malmiteria wrote: > No, i'm arguing that MI is intuitively different enough from other > context in which we use parenthesis so that most people will > intuitively understand it to work differently (which it does, we're > not defining argument to be

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

2022-04-10 Thread Steven D'Aprano
David, when you exaggerate the strength of your argument, you make all of us look bad. Like this: > Can you think of ANY context in Python in which the order of items in > parentheses isn't important?! Sure: operator.add(1, 2) == operator.add(2, 1) For that matter, there are plenty of mixins

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

2022-04-10 Thread Steven D'Aprano
On Sun, Apr 10, 2022 at 03:50:48PM -, malmiteria wrote: > Steven D'Aprano writes: > The order in which parents are placed in case of multiple inheritance > is far from being that obviously assymetrical, and the syntax does not > hint it is, quite less than inheritance syntax. Do you

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

2022-04-10 Thread Chris Angelico
On Mon, 11 Apr 2022 at 06:48, Ethan Furman wrote: > > On 4/10/22 10:17, Chris Angelico wrote: > > On Mon, 11 Apr 2022 at 02:59, Christopher Barker wrote: > > >> But if I did that, then one lib registering my units with the global > >> repository might break some other lib's use of the global

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

2022-04-10 Thread Christopher Barker
On Sun, Apr 10, 2022 at 2:37 AM Chris Angelico wrote: > That would affect how two objects interact with each other - can you > add meters and miles? Can you treat the electron-volt as a unit of > mass? All these sorts of questions belong to the application, Oh my god, no! I guess we do

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

2022-04-10 Thread Ethan Furman
On 4/9/22 21:17, Stephen J. Turnbull wrote: if 12*u.mm * 42*u.MFr == 502*u.foo: print('Well done!') That would work fine for me. But I can see why somebody who frequently uses interactive Python as a scientific calculator would prefer to write if 12 m/s * 42 s == 502 m:

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

2022-04-10 Thread Ethan Furman
On 4/10/22 10:17, Chris Angelico wrote: On Mon, 11 Apr 2022 at 02:59, Christopher Barker wrote: But if I did that, then one lib registering my units with the global repository might break some other lib's use of the global repository. Then... libraries should not register units unless it's

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

2022-04-10 Thread Brendan Barnwell
On 2022-04-10 08:50, malmiteria wrote: The order of inheritance as in, one class inherits from another do matter, quite obviously, since it's not a symetrical operation, and accordingly, the syntax is not symettrical. The order in which parents are placed in case of multiple inheritance is

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

2022-04-10 Thread Chris Angelico
On Mon, 11 Apr 2022 at 03:57, malmiteria wrote: > > David Mertz, Ph.D. writes: > > Can you think of ANY context in Python in which the order of items in > > parentheses isn't important?! > kwargs > Since Python 3.6, order of kwargs is preserved, and some functions do care about it (although only

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

2022-04-10 Thread malmiteria
David Mertz, Ph.D. writes: > Can you think of ANY context in Python in which the order of items in > parentheses isn't important?! kwargs > You are arguing that defining inheritance order is "intuitively" the one > and only context in which the order of items in parentheses makes no > difference.

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

2022-04-10 Thread David Mertz, Ph.D.
Can you think of ANY context in Python in which the order of items in parentheses isn't important?! (a, b, c) != (c, b, a) func(a, b, c) != func(c, b, a) etc. You are arguing that defining inheritance order is "intuitively" the one and only context in which the order of items in parentheses

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

2022-04-10 Thread malmiteria
David Mertz, Ph.D. writes: > Are you likewise "confused" by the fact that `a = b - c` is generally > different from `a = c - b`?! Why do you always quote confused? I'm not, but that's because i've been taught / i've experienced that since primary school. I have been taught math, but not python,

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

2022-04-10 Thread Chris Angelico
I'll summarize by quoting only a small part, since most of the line of argument is the same, with different examples. On Mon, 11 Apr 2022 at 02:59, Christopher Barker wrote: > Again, the behavior of some code should be clear and obvious to the person > writing the code. If I write code such as:

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

2022-04-10 Thread Christopher Barker
Not sure this conversation actually relates to any proposals at this point, but ... On Fri, Apr 8, 2022 at 9:54 AM Chris Angelico wrote: > You're misunderstanding the difference between "application" and > "library" here. No, I'm not -- your misunderstanding my (poorly made, I guess) point.

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

2022-04-10 Thread David Mertz, Ph.D.
On Sun, Apr 10, 2022, 11:51 AM malmiteria > "class A(B)" feels very different from "class B(A)" > but "class A(B,C)" doesn't feel so obviously different from "class A(C,B)" > Are you likewise "confused" by the fact that `a = b - c` is generally different from `a = c - b`?! >

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

2022-04-10 Thread malmiteria
Steven D'Aprano writes: > Yes well that was just silly. Of course the order matters. The order of inheritance as in, one class inherits from another do matter, quite obviously, since it's not a symetrical operation, and accordingly, the syntax is not symettrical. The order in which parents are

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

2022-04-10 Thread David Mertz, Ph.D.
On Sun, Apr 10, 2022, 10:35 AM Steven D'Aprano > I don't believe that David's denials that people are confused by super() > are even a little bit reasonable. I take the words "unconcerned" and "confused" to be distinct. ___ Python-ideas mailing list

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

2022-04-10 Thread Chris Angelico
On Mon, 11 Apr 2022 at 00:35, Steven D'Aprano wrote: > Yes well that was just silly. Of course the order matters. > > Even in single inheritance, the order matters: > > Spam inherits from Eggs inherits from Cheese > > is not the same as > > Spam inherits from Cheese inherits from Eggs > >

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

2022-04-10 Thread Steven D'Aprano
On Sun, Apr 10, 2022 at 01:53:37PM -, malmiteria wrote: > David Mertz, Ph.D. writes: > > I guess the main threshold to try to cross is ONE person other than > > malmiteria in the universe of Python users. I don't believe that David's denials that people are confused by super() are even a

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

2022-04-10 Thread malmiteria
Stephen J. Turnbull writes: > It may not be flexible, but it is quite useful. In most cases it's > quite trivial to pick up the version from the second parent: > > class C(A, B): > def foo(self, *args): > return B.foo(self, *args) > # we don't define bar() because we

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

2022-04-10 Thread malmiteria
David Mertz, Ph.D. writes: > Malmiteria is the FIRST person I've met "confused" by super(). No need to capitalise the first letter in malmiteria. I'm not sure what the quotes surrounding confused mean. What do you mean by those? > I guess the main threshold to try to cross is ONE person other

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

2022-04-10 Thread malmiteria
Matsuoka Takuo writes: > For your particular case of a diamond, the solution below seems > simpler to me than yours. What problems may it create which your > solution won't? Or you might refine the problem. It's not easy to > see the real value of your suggestions. > > ``` > class HighGobelin:

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

2022-04-10 Thread Matsuoka Takuo
For your particular case of a diamond, the solution below seems simpler to me than yours. What problems may it create which your solution won't? Or you might refine the problem. It's not easy to see the real value of your suggestions. ``` class HighGobelin: def scream(self):

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

2022-04-10 Thread Chris Angelico
On Sun, 10 Apr 2022 at 18:44, Ronald Oussoren via Python-ideas wrote: > > > > On 8 Apr 2022, at 16:33, Steven D'Aprano wrote: > > On Tue, Apr 05, 2022 at 02:17:00PM +1000, Chris Angelico wrote: > > Do you ever have one module that's using statute miles and > another that's using nautical miles,

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

2022-04-10 Thread Ronald Oussoren via Python-ideas
> On 8 Apr 2022, at 16:33, Steven D'Aprano wrote: > > On Tue, Apr 05, 2022 at 02:17:00PM +1000, Chris Angelico wrote: > >> Do you ever have one module that's using statute miles and >> another that's using nautical miles, but *not both in the same >> module*? The only reason to have them