Oct 15, 2021

Python Itertools

Python itertools module provides a set of iterator blocks that can be used to combine iterators into a new iterator which will apply some modifications during the iteration of the sequences. For example building blocks like cycle allows infinitely cycling through a sequence, another example is groupby which provides a new iterator giving the groups on each iteration. In today’s post, we will look at some of the functions provided by itertools with examples.

Python

Oct 08, 2021

Python Collections

Python comes with general purpose datatypes like dict, list or set. Those types are commonly used everywhere with the best tradeoff in term of performance and application scope. But there are times where we might see ourselves repeating a specific implementation, for example counting values while storing them in a dict is one of those cases. To cater for those repeated scenarios, the collections module gives us access to alternative types that can be used for specialized purposes. In today’s post we will look at some of those types with examples.

Python

Oct 01, 2021

Sorting In Python

Sorting lists in Python is very easy provided that we know how to use the sorting functionalities. Python comes with list.sort() and sorted() function, both behaving somewhat in the same way with the only different that the first one sorts in place whereas the later returns a new sorted list without altering the existing list. In today’s post we will look at different sorting scenarios and how we can achieve them using Python sort functionalities.

Python

Sep 24, 2021

Decorators In Python

In Python, we can add extra functionalities to existing functions with decorators but this comes with small gotchhas. The functools module comes with a special wraps decorator which addresses those issues. In today’s post we will look at how to use wraps with example.

Python

Sep 17, 2021

Function Overload In Python With Single Dispatch

Python supports overloading functions via single dispatch. With single dispatch we can define multiple implementations of a function and have it chosen based on a single argument. In this post we will look at how single dispatch works with example.

Python

Sep 10, 2021

Partial Function Application In Python

Partial function application is a useful tool to reduce the signature of a function by fixing the first arguments which then result in a new function with the remaining arguments. In this post, we will see when partial application is useful in Python and how we can implement it.

Python

Sep 03, 2021

Depth First Seach And Breath First Search In Python

In Python, it is very easy to implement depth first search (DFS) and breath first search (BFS) algorithms using the built in data types and recursion. In today’s post, we will look at some different flavours of DFS and BFS together with examples where they are used.

Python

Aug 27, 2021

Random Module In Python

The random module in Python provides a way to generate pseudo-random numbers for various distributions. In this post, we will explore the most commmonly used functionalities of the random module; generating random integers and selecting randomly from sequences.

Python

Aug 20, 2021

Python Built In Functions

Python comes with a handful of built in functions provided by the standard library. In today’s post, we will look some of them which are very useful in day to day programming.

Python

Aug 13, 2021

List Slicing In Python

Lists are one of the most versatile structures in Python. They allow us to keep lists elements which can be of different types and access them by index with constant time complexity. One of the best features of lists in Python is the slicing mechanism.

Python

Aug 06, 2021

Python Priority Queue

Priority queues are useful to keep track of smallest elements in Python. A typical example would be to keep track of the smallest elements of a collection, for example first, second, third elements, we can simply keep popping out of the priority queue to get them. Python comes with a built in pirority queue via the library heapq. In today’s post, we will look at the main functionalities of heapq with examples.

Python

Jul 30, 2021

Python Dictionary

Python dictionary is a structure that can be used to store key/value data with constant time for access. Dictionary structures in Python are very versatile which makes them popular and we can see them being used in many projects. They allow us to store keys and values of different types, provide us ways to iterate over the keys or values and have different ways to delete values. In today’s post, we will explore all the functionalities of dictionaries in Python.

Python

Jul 16, 2021

Pointers To Functions In C

Last week we covered the basics of C pointers with their definitions and how to use them in variables and functions. In today’s post we will look at pointers to function and more specificities around pointers like NULL pointer or void return.

C Language

Jul 09, 2021

Pointers In C

Pointers are variables containing addresses of other variables. In C, pointers are used in many scenarios where they improve the code readability or where they are just necessary. In this post, we’ll explore what C pointers represent, how they can be used in functions, and explore the relationship between pointers and arrays.

C Language