[Tutor] OOPs and general Python questions.

mhysnm1964 at gmail.com mhysnm1964 at gmail.com
Thu Apr 20 03:36:10 EDT 2023


Everyone,

Thank you for the responses. The Chat.gpt question was more of interest sake as the way the company was promoting the capability. 

The explanations of the superclass question is a bit clearer.

Sean 


-----Original Message-----
From: ThreeBlindQuarks <threesomequarks at proton.me> 
Sent: Thursday, April 20, 2023 2:30 AM
To: mhysnm1964 at gmail.com
Cc: tutor at python.org
Subject: Re: [Tutor] OOPs and general Python questions.

Sean,

What is a super class is beyond the scope of this forum but we could discuss what a superclass is compared to a subclass.

Loosely, you start with a class and decide you like what you see and would like a version with a few changes. You make a new class where you specify what class it is based on. The new class is a subclass of the older one and the older one is now a superclass of the new one. It can be that simple.

Realistically, all classes exist in a hierarchy leading back to a top-level you may not be aware of. Classes can have multiple inheritance. When you want to invoke some action from a superclass it can be as simple as calling superclass() but can also be &$%*@.

Does Python care about order. Yep. Oh, and sometimes nope.

More seriously, unlike some other languages that look ahead before evaluating in some context, Python generally expects things to refer to previously identified objects or functions or whatever. It can be more complex and interesting.

A case where order can really matter is when a class declares multiple other classes it inherits from as the search for things it uses (like members in superclasses with the same names, can be a bit hard to explain.

As to your last question, code can be modified in many ways as it runs. Python is generally interpreted. The question is too general. What specifically do you want to know if it can be modified and in what ways. Some people use fairly direct methods and some use some rather arcane ones.

Just as an example, if you had a function declared and used and later decided you want to wrap that function in another that adds some functionality by doing something before and/or after the function is called and then return a possibly modified result, you can trivially do it using something like a decorator that stores the result back into the same name. Other things may be hard to achieve and some may not be possible within a session such as when measures have been taken to stop you from accessing something directly. 

Of course, none of us here is currently an AI so our answers ...





Sent with Proton Mail secure email.

------- Original Message -------
On Wednesday, April 19th, 2023 at 4:30 AM, mhysnm1964 at gmail.com <mhysnm1964 at gmail.com> wrote:


> All,
> 
> 
> 
> I have some really broad and general questions to ask.
> 
> 
> 
> What is a super class?
> 
> Does python care the order of classes and methods?
> 
> If you are using "python -m pdb script_name", can you reload the file 
> using this debugging tool? I couldn't find anything which mention this?
> 
> Chat.gpt references the ability of modifying code while the program is 
> being executed. How difficult is this to achieve? A high level answer 
> is all I need.
> 
> 
> 
> 
> 
> Sean
> 
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list