Built-in Methods

What is the Python __slots__ function?

Hello readers, this article will help you to understand what __slots__, their advantages, disadvantages, and usage. What are __slots__? It is used in class and object implementation programs.  __slots__ is a class variable that is usually assigned a sequence of strings that are variable names used by instances. The primary goal of using __slots__ is for …

What is the Python __slots__ function? Read More »

Python str() Function

Python str() function is one of the built-in functions. This function returns the string representation of the object. If there is no argument provided, it returns an empty string. Python str() Function Examples Let’s look at some simple examples of the str() function. How to implement str() function for an Object When we call the …

Python str() Function Read More »

Assertions in Python

Let us learn about a commonly used testing and debugging technique called Assertions in Python. We will learn what assertions are, why they are used, when not to use them, and their syntax. So let’s get started. What are Assertions in Python? Assertions in Python are statements that are used to assert a condition on …

Assertions in Python Read More »

The Dot Notation in Python

Let’s discuss the dot notation in Python today. If you have even a little experience with coding in Python, or if you’ve been following our AskPython blog, you should have come across the term Object-Oriented Programming. It is a programming paradigm based on the concept of real-world Objects. Each object has certain attributes that describe …

The Dot Notation in Python Read More »