Image for post
Image for post
-serve Photo by Joseph Barrientos on Unsplash

Understanding various types of services in Kubernetes

Understanding networking in Kubernetes is paramount. Understanding Services can let us enable our pods to talk to each other and choose the right strategy based on the origin of traffic (either from within or outside the cluster) for our user-defined applications and services.

This article aims to cover the significance of Services in a Kubernetes cluster, the various shortcomings they overcome, followed by various types of Services objects offered by k8, their capabilities, and when to use each one of them.

NOTE: To avoid any confusion between the two services terms we’ll be using throughout, one refers to the Services…

Understanding Convolutional, Pooling and Fully Connected layers of CNN

Deep learning in computer vision has made rapid progress over a short period. Some of the applications where deep learning is used in computer vision include face recognition systems, self-driving cars, etc.

This article introduces convolutional neural networks, also known as convnets, a type of deep-learning model universally used in computer vision applications. We’ll be deep-diving into understanding its components, layers like convolutional layer, pooling layers, and fully connected layers and how they can be applied to solve various problems.

So let’s get started.

The objective of CNNs:

Image for post
Image for post

Above is an image of a cat, as a kid we are told that this animal…

Image for post
Image for post
Photo by Prateek Katyal on Unsplash

Exploring some of the unfamiliar yet cool Python features

Python has lots of cool features such as first class functions, lambdas, generators, comprehensions etc. There are plenty of articles on the subject. However, there are some of the features in Python, which are generally not so commonly used.

In this article, we’ve tried to summarize some of the these features, which will provide us a better knowledge on the subject and can come in handy at times for developers.

So let’s dive in!

1. Limiting CPU and Memory Usage

Resources like CPU, memory utilised by our Python program can be controlled using the resource library.

To get the processor time (in seconds) that a process…

Image for post
Image for post
Photo by Fabrizio Verrecchia on Unsplash

Understanding the advantage of using datetime over time module

Coordinated Universal Time (UTC) is the standard, time-zone independent representation of time. UTC works great for computers that represents time as seconds since the UNIX epoch (starting point against which we can measure the passage of time).

For example, if we define the epoch to be midnight on January 1, 1970 UTC — the epoch as defined on Windows and most UNIX systems — then we can represent midnight on January 2, 1970 UTC as 86400 seconds (24 * 60 * 60) since the epoch.

But UTC isn’t ideal for humans. Since we usually refer time relative to where we’re…

Image for post
Image for post

Understanding the single expression functions in Python

In this article, we’ll learn about the anonymous function, also known as lambda functions. We’ll try to decode as to why there’s a big fuss about lambdas, understand their syntax and when to use them.

So Let’s jump right in.

The lambda keyword in Python provides a shortcut for declaring small anonymous functions. Lambda functions behave just like regular function declared with def keyword. They can be used whenever function objects are required.

For example, this is how we’d define a simple lambda function carrying out an addition:

>>> add = lambda x, y: x + y
>>> add(22, 10)…

Image for post
Image for post
Photo by Ashes Sitoula on Unsplash

Understanding the usage of generators and yield in Python

This article details how to create generator functions and why we would want to use them in the first place.

The simplest choice for functions that produce a sequence of result is to return a list of items. For example, let’s say we need to find the index of every word in the string. Here, we accumulate results in a list using the append method and return it at the end of the function.

def index_words(text):
result = []
if text:
for index, letter in enumerate(text):
if letter == ' ':
result.append(index + 1)
return result

This works as…

Image for post
Image for post
Photo by American Public Power Association on Unsplash

Understanding Array Data Structures in Python

An array is a fundamental data structure available in most programming languages, and it has a wide range of uses across different algorithms.

In this article, we’ll take a look at less known array implementation in Python that only use core language features that’s included in Python standard library.

We’ll see the strengths & weaknesses of each approach so we can decide which implementation is right for our use-case. But before we jump in, let’s cover some of the basics first.

How do arrays work, and what are they used for?

Arrays consist of fixed-size data records that allow each…

Image for post
Image for post
Photo by Zhen Hu on Unsplash

Understanding how to use locks in our Python programs

After learning about the global interpreter lock (GIL), many new Python programmers assume that we can forgo using mutual-exclusion locks (mutexes) in our code altogether.

If the GIL is already preventing Python threads from running on multiple CPU cores in parallel, it must also act as a lock for a program’s data structures, right?

But beware, this is truly not the case. The GIL will not protect us. Although only one Python thread runs at a time, a thread’s operation on data structures can be interrupted between any two instructions in the Python interpreter.

This is dangerous if we access…

Image for post
Image for post
Photo by Sandy Millar on Unsplash

Tour of various Dictionaries in Python

In Python, dictionaries (dicts) are a central data structure. Dicts store an arbitrary number of objects, each identified by a unique dictionary key.

Dictionaries are also often called maps, hashmaps, lookup tables, or associative arrays. They allow for the efficient lookup, insertions and deletion of any object associated with a given key.

Dictionaries are one of the most frequently used and most important data structures in computer science. So, how does Python handle dictionaries? Let’s take a tour of the dictionary implementations in core Python and the Python standard library.

dict - Our Go-To Dictionary

Because of their importance, Python features a robust dictionary implementation…

Image for post
Image for post
Photo by Nicole Wolf on Unsplash

Understanding internal workings of for-in Loop in Python

Repetitive execution of the same block of code over and over is referred to as iteration. Definite iteration (number of iterations is known) is very common in any programming language including Python. Definite iteration loops are frequently referred to as for loops.

The two concepts of iterables and iterators form the basis of definite iteration in Python.

The aim of the article is to get an understanding of iterables and iterators and then tie them together to get an insight of how the Python’s elegant loop construct work behind the scenes? How does the loop fetch individual elements from the…

Rachit Tayal

Sports Enthusiast | Senior Deep Learning Engineer. Python Blogger @ medium. Background in Machine Learning & Python. Linux and Vim Fan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store