Python - What are Static and Class Methods?

Have you ever seen some Python code and wondered what @staticmethod and @classmethod do ? Well, let me explain ... @staticmethod A static method is a method that knows nothing about the class or instance it was called on. The class instance, therefore, is NOT passed in as an implicit first argument…

Read More

A Hands-on Guide to Network Source of Truth (NSoT)

What is NSoT? Network Source of Truth (NSoT) is a Django based opensource application for the management of IP addresses (IPAM), network devices and network interfaces. NSoT provides the following for the administration of the database inventory: REST-based API CLI client Python modules UI As you will shortly see the…

Read More

Python - What does Property() do ?

What is Property()? When reading Python code you may have seen the following: class MyClass(object): def __init__(self): pass @property def do_something(self): return True The purpose of this function is to create a property of a class. A property looks and acts like an ordinary attribute, except…

Read More

A Hands-on Guide to Netmiko and TextFSM

Introduction Within this article, we will look at two tools used in the world of network automation - Netmiko and TextFSM. Our examples will be based on a small topology consisting of 3 devices an Arista, a Cisco NXOS9K and a Cisco IOS router. Below shows the topology, Figure 1:…

Read More

Python - Threading vs Multiprocessing

Introduction In this article we will look at threading vs multiprocessing within Python, and when you should use one over the other. TL;DR What is the GIL (Global Interpreter Lock)? - Prevents more than 1 thread being run within a single CPython Interpreter/process. Why do we need the…

Read More

Python - A Look into Generators

Introduction In this short article we will look into Python generators. A generator is, a function that returns an object (iterator) which we can iterate over (one value at a time).[1] Therefore, unlike lists, they are considered lazy. The key benefit to generators is that as they only produce…

Read More