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 ... 2024.01.08 Python
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 ... 2023.11.22 Python
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.dum... 2023.10.20 Python
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... 2023.08.14 Python
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... 2023.08.09 Python
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. 2023.08.07 Python
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. 2023.07.10 Python
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. 2023.04.05 Python
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. 2023.03.27 Python
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. 2023.03.24 Python