Python | Difference between @staticmethod and @classmethod A staticmethod is a method that knows nothing about the class or the instance it was called on. It just gets the arguments that were passed, no implicit first argument. …

Last updated 1 year, 10 months ago | 378 views

Tags:- Python

Finalize method is used for freeing up the unmanaged resources and cleaning up before the garbage collection method is invoked. This helps in performing memory management tasks.

Last updated 1 year, 10 months ago | 378 views

Tags:- Python

Python | Deep and Shallow copies Shallow copy does the task of creating new objects and storing references to original elements. This does not undergo recursion to create copies of nested objects. It just copies the …

Last updated 1 year, 10 months ago | 378 views

Tags:- Python

Python | new_style and old_style Old-style: With old-style classes, class and type are not quite the same things.  If obj is an instance of an old-style class, obj __class__ designates the class, but the type(obj) is always …

Last updated 1 year, 10 months ago | 377 views

Tags:- Python

Django | ORM ORM stands for Object-relational Mapper. Instead of interacting with the database by writing raw SQL queries and converting the data returned from the query into a Python object, ORM allows us to interact …

Last updated 1 year, 10 months ago | 375 views

Tags:- Django

We can use the Counter method from the collections module from collections import Counter dict1 = {'a': 5, 'b': 3, 'c': 2} dict2 = {'a': 2, 'b': 4, 'c': 3} new_dict = Counter(dict1) + Counter(dict2) …

Last updated 1 year, 8 months ago | 374 views

Tags:- Python

Difference between Python array and Python list Array Lists it is used to store only homogeneous data. The list is used to store heterogeneous data it occupies less amount of memory as the array stores …

Last updated 1 year, 8 months ago | 374 views

Tags:- Python

Python | append() and extend() Function Both append() and extend() methods are methods used to add elements at the end of a list. append(element): append() method adds the given element at the end of the list. …

Last updated 1 year, 10 months ago | 374 views

Tags:- Python

Interpreted language An Interpreted language executes its statements line by line. Languages such as Python, Javascript, R, PHP, and Ruby is a prime examples of Interpreted languages. Programs written in an interpreted language runs directly from …

Last updated 1 year, 10 months ago | 370 views

Tags:- PHP Python

[::-1] is used to inverse the order of a sequence. >>> my_list = [1,2,3,5,6,7,8,9] >>> my_list[::-1] [9, 8, 7, 6, 5, 3, 2, 1]    

Last updated 1 year, 8 months ago | 368 views

Tags:- Python

Python | Self Self is used to represent the instance of the class. With this keyword, you can access the attributes and methods of the class in python. It binds the attributes with the given arguments.   …

Last updated 1 year, 10 months ago | 363 views

Tags:- Python

Python modules are the files having python code which can be functions, variables, or classes. These go by .py extension. The most commonly available built-in modules are: os math sys random re datetime JSON

Last updated 1 year, 10 months ago | 363 views

Tags:- Python

Django | Set up Database We need to edit the setting.py file present in the project, which contains all the settings related to the project. By default Django comes with an SQLite database; The  SQLite database …

Last updated 1 year, 8 months ago | 358 views

Tags:- Django

Python | ‘is’, ‘not’, and ‘in’ operators is: Returns True if both variables are the same object >>> x = 5 >>> y = 5 >>> z = 1 >>> x is y True >>> x …

Last updated 1 year, 8 months ago | 346 views

Tags:- Python