0

OOP Python 3

Can anyone please explain this In a python file I have a variable named abc. It may be a string, list or any other object If I call a method like strip() [if it's a string] or append() [if it's a list] where the functions are defined and how they are called. If we create a class A() which contains a method xyz(), we create a instance of that class say inst = A() and call inst.xyz() to access that method. So my question is what happens when we don't define any class or metod and call starigway like the following abc.append() str.upper() etc etc

23rd Jun 2018, 6:24 AM
Anuj Kumar Nath
Anuj Kumar Nath - avatar
1 Antwort
+ 1
Python has some predefined classes for lists, strings, integers, etc (every supported type has a corresponding class.) You are calling the methods of those classes.
23rd Jun 2018, 12:16 PM
John Wells
John Wells - avatar