Ben Chuanlong Du's Blog

It is never too late to learn.

Understand the Design of Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Design

  1. There is no constant variables in Python. If you need a constant variable in Python, just define one and never change it. It is suggested that you use UPPER_WITH_UNDERSCORE naming …

Calling Shell from Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. subprocess.run is preferred to the function os.system for invoking shell commands. For more discussions, pleaser refer to [Hands on the Python module subprocess]https://www.legendu.net/en/blog …

Tips on Monkey Patching in Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

A MonkeyPatch is a piece of Python code which extends or modifies other code at runtime (typically at startup).

A monkey patch is a way for a program to extend or …

Error/Exception Handling and Testing in Scala

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

assert vs require vs assume

assert means that your program has reached an inconsistent state. This might be a problem with the current method/function (think of it a bit as …