Python

Sponsored links
Python

Python Check performance by using timeit

We should somehow check the performance if we want to compare some implementations to know a faster one. It can be done ...
Python

Python How to add custom fields to logging formatter

logging module is a useful module for logging. The log format somehow needs to be defined to make it more readable. The ...
Python

Python How to convert a nested JSON to a class

It's easy to convert an object to JSON and JSON to an object in Python. json module provides the following functions. du...
Python

Python How to pass a class constructor as an argument

Is it possible to pass a constructor as a parameter? Yes, it is. There are multiple ways to instantiate a different clas...
Python

Python How to mock constructor with mockito for unit testing

A class constructor directly needs to be called in a class in some cases. It might not be a good design but sometimes it...
Python

Python How to handle an error from finally block

If an error occurs in finally block, the first error caught in except block is overwritten. How can we know both errors? Let's split the block and add both errors into one custom error.
Python

Python Find the fastest way to access a property for performance

Which structure is the fastest way to access a property? Let's compare the different structures and choose the fastest one for performance tuning.
Python

Python How to run another Python script with arguments

Another Python script can be run by exec function. However, arguments can't be specified with it. How is it implemented? Okay, use subprocess.call or subprocess.run instead.
Python

Python How do nested groups work for regex

If there are several formats and data need to be extracted from the string, the nested group might neet to be used in the regex string. How does it actually work? Let's check together with me.
Python

Python Convert str to int/float, dict/list to str, and vice versa

Conversion is often needed to change the data type. This post covers main cases where you need in your production code. Let's check how to convert a variable.
Sponsored links