Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Cameron Simpson
On 27Mar2023 12:03, Cameron Simpson wrote: On 27Mar2023 01:53, Jen Kris wrote: But that brings up a new question.  I can create a class instance with x = BinaryConstraint(), That makes an instance of EqualityConstraint. Copy/paste mistake on my part. This makes an instance of BinaryConstr

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Cameron Simpson
On 27Mar2023 01:53, Jen Kris wrote: Thanks for your reply.  You are correct about the class definition lines – e.g. class EqualityConstraint(BinaryConstraint).  I didn’t post all of the code because this program is over 600 lines long.  It's DeltaBlue in the Python benchmark suite.  Doubtles

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Jen Kris via Python-list
Cameron, Thanks for your reply.  You are correct about the class definition lines – e.g. class EqualityConstraint(BinaryConstraint).  I didn’t post all of the code because this program is over 600 lines long.  It's DeltaBlue in the Python benchmark suite.  I’ve done some more work since thi

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Cameron Simpson
On 26Mar2023 22:36, Jen Kris wrote: At the final line it calls "satisfy" in the Constraint class, and that line calls choose_method in the BinaryConstraint class.  Just as Peter Holzer said, it requires a call to "satisfy."  My only remaining question is, did it select the choose_method in th

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Jen Kris via Python-list
Based on your explanations, I went through the call chain and now I understand better how it works, but I have a follow-up question at the end.    This code comes from the DeltaBlue benchmark in the Python benchmark suite.  1 The call chain starts in a non-class program with the following call

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Jen Kris via Python-list
Thanks to Richard Damon and Peter Holzer for your replies.  I'm working through the call chain to understand better so I can post a followup question if needed.  Thanks again. Jen Mar 26, 2023, 19:21 by rich...@damon-family.org: > On 3/26/23 1:43 PM, Jen Kris via Python-list wrote: > >> The

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Richard Damon
On 3/26/23 1:43 PM, Jen Kris via Python-list wrote: The base class: class Constraint(object): def __init__(self, strength):     super(Constraint, self).__init__()     self.strength = strength def satisfy(self, mark):     global planner     self.choose_method(mark) The sub

Re: How does a method of a subclass become a method of the base class?

2023-03-26 Thread Peter J. Holzer
On 2023-03-26 19:43:44 +0200, Jen Kris via Python-list wrote: > The base class: > > > class Constraint(object): [...] > def satisfy(self, mark): >     global planner >     self.choose_method(mark) > > The subclass: > > class UrnaryConstraint(Constraint): [...] >     def choose_method(se

How does a method of a subclass become a method of the base class?

2023-03-26 Thread Jen Kris via Python-list
The base class: class Constraint(object): def __init__(self, strength):     super(Constraint, self).__init__()     self.strength = strength def satisfy(self, mark):     global planner     self.choose_method(mark) The subclass: class UrnaryConstraint(Constraint): def __init__

Re: Patrick Sheehan: Major Issues with Python

2023-03-26 Thread Thomas Passin
On 3/25/2023 4:03 PM, Patrick Sheehan wrote: Hello, I have been working with the attached book (See photo) Photos do not come through on this list, so don't bother to attach any. Type or copy-paste any useful text. to try to learn Python and so far it has been a complete nightmare trying to g

Re: Patrick Sheehan: Major Issues with Python

2023-03-26 Thread MRAB
On 2023-03-25 20:03, Patrick Sheehan wrote: Hello, I have been working with the attached book (See photo) to try to learn Python and so far it has been a complete nightmare trying to get python installed and operating correctly. I have received a plethora of error messages and consulted youtube

Re: Patrick Sheehan: Major Issues with Python

2023-03-26 Thread Mats Wichmann
On 3/25/23 14:03, Patrick Sheehan wrote: Hello, I have been working with the attached book (See photo) to try to learn Python and so far it has been a complete nightmare trying to get python installed and operating correctly. I have received a plethora of error messages and consulted youtube vid

Patrick Sheehan: Major Issues with Python

2023-03-26 Thread Patrick Sheehan
Hello, I have been working with the attached book (See photo) to try to learn Python and so far it has been a complete nightmare trying to get python installed and operating correctly. I have received a plethora of error messages and consulted youtube videos and chat groups to try to remedy the is