Category: Code Snippets

Difference between isinstance and type in Python

Introduction Python programming language is a dynamically typed language. In other words, variable types are not explicitly declared as in statically typed languages (ex. C++). Instead, type checking is performed at runtime as opposed to compile time. The debate of which is better? a dynamically typed or statically typed language is not discussed in this

Python for loop else clause

Introduction In this post, we are going to discuss a rarely used Python feature. We are familiar with the regular for and while loops but using an else clause after a loop is not common. We can live without this language feature however it can be used to write elegant code. Let us take an