Today I became aware of the existence of the builtin Python module fractions. The fractions module handles rational number arithmetic. Here's a simple example using the Fraction class to covert a decimal into a Fraction with the numerator and denominator reduced to the lowest terms. My ...
today I learned
.mjs extension (A JavaScript module file) | Today I Learned
Today, I needed to reference the MDN docs for JavaScript modules. As I skimmed through the page, something caught my eye: a file name with the .mjs extension. My first reaction was confusion. This was my first time seeing a file with that extension. Upon further reading, I learned .mjs is a ...
Avoid using mutable values as default parameter values in Python (Today I Learned)
Today I learned something interesting about the way Python functions behave with default parameter values: avoid using mutable objects such as lists as default values for function parameters. What's the problem? Default parameter values are evaluated when function is evaluated. Which means ...
There’s a name for that: the Kebab Case
You know that feeling where you want to describe something, but you don't know the correct or accurate term to label it as? That was me whenever I encountered code or filenames where the letters were all lowercased and the words were separated with a dash. While I was reading through the ...