Yes, it is possible if the base class is instantiated by other child classes or if the base class is a static method.

Last updated 3 years, 4 months ago | 1440 views

Tags:- Python

Python | accessors, mutators, and @property What we call getters and setters in languages like Java, we term accessors and mutators in Python. In Java, if we have a user-defined class with the property ‘x’, we …

Last updated 3 years, 4 months ago | 1440 views

Tags:- Python

Windows | Set path and environment variables in Windows 10 Press the + to access the Power User Task Menu. Now, select the System option. In the About window, click the Advanced system settings link under Related settings from the right side. In the Advanced tab, click the  button. In …

Last updated 3 years, 2 months ago | 1438 views

Tags:- Windows

yield is a keyword beares the ability to turn any function into a generator.  Much like the standard return keyword, but returns a generator object. It is also true that one function may observe multiple …

Last updated 3 years, 4 months ago | 1438 views

Tags:- Python

Python program to count the number of capital letters in a file. with open(FILE_NAME) as my_file: count = 0 text = my_file.read() for character in text: if character.isupper(): count += 1 print(count)    

Last updated 3 years, 2 months ago | 1436 views

Tags:- Python

Django is a framework that allows you to build large projects. On the other hand, Flask is used to build smaller websites but flask is much easier to learn and use compared to Django. Django is …

Last updated 3 years, 4 months ago | 1436 views

Tags:- Django

Python | Access Specifiers Python does not make use of access specifiers specifically like private, public, protected, etc. However, it does not derive this from any variables. It has the concept of imitating the behavior of …

Last updated 3 years, 4 months ago | 1429 views

Tags:- Python

Python | map() Function The map() function executes a specified function for each item in an iterable. The map() function in Python has two parameters, function and iterable. The map() function takes a function as an argument and …

Last updated 3 years, 4 months ago | 1427 views

Tags:- Python

Django | Set up environment variables in Django   1. Install Django Environ In your terminal, inside the project directory, type: $ pip install django-environ 2. Import environ in settings.py import environ 3. Initialise environ …

Last updated 3 years, 2 months ago | 1426 views

Tags:- Django

Python | Dogpile effect In case the cache expires, what happens when a client hits a website with multiple requests is what we call the dogpile effect. To avoid this, we can use a semaphore lock. When …

Last updated 3 years, 4 months ago | 1425 views

Tags:- Python

Python | context manager Context managers allow you to allocate and release resources precisely when you want to. The most widely used example of context managers is the with() statement.  with open('some_file', 'w') as opened_file: opened_file.write('Hola!')   The …

Last updated 3 years, 4 months ago | 1423 views

Tags:- Python

Django | Model  A model is a Python class in Django that is derived from the django.db.models.Model class. A model is used in Django to represent a table in a database. It is used to interact …

Last updated 3 years, 4 months ago | 1423 views

Tags:- Django

Python | Main Function In the world of programming languages, the main is considered as an entry point of execution for a program. But in python, it is known that the interpreter serially interprets the file …

Last updated 3 years, 4 months ago | 1422 views

Tags:- Python

We can use the python re module to match the string import re def check(txt): # regex pattern pattern = 'ab{4,8}' if re.search(pattern, txt): print('Match found') else: print('Match not found') check("abcbbbb") # Match not found check("aabbbbbc") # …

Last updated 3 years, 2 months ago | 1421 views

Tags:- 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 3 years, 2 months ago | 1418 views

Tags:- Python