Python object-oriented
Python is an interpreted language, it means that commands are executed through a piece of software by the Python interpreter.
Python is also an object-oriented language, and classes form the basis for all the data types of the language. Having in mind this point of view, we need to consider everything on python as an object, including the traditional primitives of other languages. In the following table we show a list of the built-in classes for Python.
Each one of those types allows to create an object: In the traditional way and as an object. For example:
Ways to define an Integer x with value 5:
x = 5
x= int(5)
x= int('5')
The first option is the most common, the second is not used frequently and just shows how the constructor can receive the value, and the third one is used very often to cast a a value that comes as a string.
Similar approaches are followed for the other types, and works in different ways, but if unsupported value is provided to the constructor, you would get a Value error exception.
Calling Methods
If everything is an object on python, it also means that every object has built-in methods and It's possible to use it following the standard dot notation for objects:
object.method(arg1, arg2...)
For example, the string objects have a lot of methods that we can use for our convenience:
my_str = 'Andres'
my_str.lower() // andres
my_str.upper() //ANDRES
Each one of the examples above, return a new object with modified value of the original. It means that you can apply another method to the returned object in cascade. For example:
my_str = my_str.lower().startswith('a') // True
This is just an introduction, even so with these small examples you can see how powerful is Python and for you are invited to explore all the methods provided by the different types of objects.
If you want to know more about python, the resource is https://www.python.org/
Also, there is a recommended article: 5 reasons to learn python
Happy coding!
Andres, thanks for sharing! 👌