What are negative indexes and why are they used?
Negative indexes mean that you count from the right instead of the left. So, list[-1] refers to the last element, list[-2] is the second-last, and so on.
What is an Interpreted language?
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 …
What architecture does Django use?
Django follows a Model-View -Template (MVT) architecture which is a variant of the MVC architecture. Model: Logical data structure behind the entire app and signified by a database. A model is used in Django to …
Set path and environment variables in Windows Vista and Windows 7
Windows | Set path and environment variables in Windows Vista and Windows 7 On the desktop, right-click the Computer icon and select Properties. or Press the and right-click the Computer option in the Start menu, and select Properties. Click the Advanced System Settings link in the left column. In …
What are decorators?
Python | What are decorators A decorator in Python is a function that modifies the behavior of an existing function or class without any modification to the original source code. A decorator takes another function as its argument and returns yet …
How is Multithreading achieved in Python?
Python has a multi-threading package, but commonly not considered good practice to use it as it will result in increased code execution time. Python has a constructor called the Global Interpreter Lock (GIL). The GIL ensures …
What’s the use of Middleware in Django?
Django | Middleware Middleware is something that executes between the request and response. In simple words, you can say it acts as a bridge between the request and response. Similarly In Django when a request is made …
What is PYTHONPATH in Python?
Python | PYTHONPATH PYTHONPATH is an environment variable that you can set to add additional directories where Python will look for modules and packages. This is especially useful in maintaining Python libraries that you do not wish …
What is a dynamically typed language?
Python is an interpreted language, that executes each statement line by line and thus type-checking is done on the fly, during execution. Hence, Python is a Dynamically Typed Language. Typing refers to type-checking in programming …
Set path and environment variables in Windows 2000 and Windows XP
Windows | Set path and environment variables in Windows 2000 and Windows XP On the desktop, right-click the Computer icon and select Properties. or Press the and right-click the Computer option in the Start menu, and select Properties. In the System Properties window, click the Advanced tab. In the Advanced tab, click …
Why is finalize used?
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.
Whenever you exit Python, is all memory de-allocated?
The answer here is no. The modules with circular references to other objects, or to objects referenced from global namespaces, aren’t always freed on exiting Python. Plus, it is impossible to de-allocate portions of memory …
What is pass in Python?
Python | Pass Statement The pass statement is used as a placeholder for future code. It represents a null operation in Python. It is generally used for the purpose of filling up empty blocks of …
What is a namedtuple?
Python | namedtuple A namedtuple will let us access a tuple’s elements using a name/label. We use the function namedtuple() for this, and import it from collections. >>> from collections import namedtuple #format >>> result=namedtuple('result','Physics Chemistry …
What does *args and **kwargs mean?
Python | *args and **kwargs *args is a special syntax used in the function definition to pass variable-length arguments. e.g: myFun(*argv) def func(*args): for i in args: print(i) func(2,3,4) #Output 2 3 4 **kwargs is …