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 comes with general purpose datatypes like
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.
Sorting lists in Python is very easy provided that we know how to use the sorting functionalities. Python comes with
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.
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 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.
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.