Python Objects: Everything is an Object

View profile for Muhammad Farhan

Informatics Engineering Student | Python & AI Enthusiast

Python is an object-oriented language. You’ve probably heard this sentence many times. But what does it actually mean in simple terms? It means that all data items in Python are objects. In Python, similar data items are grouped under a type, also called a class. The terms type and class mean the same thing, so you can use them interchangeably. So it means that everything in Python is an object. Numbers, text, lists, dictionaries all of them are objects For example: 5 is an object of type int 3.14 is an object of type float "hello" is an object of type str [1, 2, 3] is an object of type list {"a": 1} is an object of type dict You can also get help for any type by typing help(typename) in the Python shell, where typename is a type or class in Python.

To view or add a comment, sign in

Explore content categories