I very much enjoyed this one-hour talk by Brian Kernighan:

He’s absolutely right about small languages. Doing a big one is hard to get right.

**04**
*Monday*
Jan 2021

Posted Interesting

inI very much enjoyed this one-hour talk by Brian Kernighan:

He’s absolutely right about small languages. Doing a big one is hard to get right.

**03**
*Saturday*
Oct 2020

Posted CS101

in**Tags**

For me, Python modules seem to divide into two basic classes: library modules and application modules. The former contain basic building blocks, but the latter has top-level routines the operating system invokes when it runs the application.

Today I thought I’d post about the application framework I use for all apps.

**01**
*Tuesday*
Sep 2020

**Tags**

Cartesian product, Japanese multiplication method, multiplication, Pillow (PIL fork), Python, Python code

On my regular blog I just posted about a Japanese visual multiplication method. It’s a cute trick that ties into the notion of grid multiplication techniques. (In general, multiplication techniques are of some interest due to the Mandelbrot set, which requires multiplying large numbers lots of times.)

It turns out code to generate the patterns was a lot easier than I thought it would be. The hardest part was generating the diagonal summing lines.

**15**
*Friday*
May 2020

Posted Fun

inThis post contains some simple code for calculating the square root of 2 and then generating the bits of the value.

It’s a companion to a post on my other blog.

**07**
*Thursday*
May 2020

Posted Fun

inLast time I showed you the functions necessary for Life — for John Conway’s *game* of Life, that is. We ended up with a set of functions you can use to generate frames of a Life session.

This time I’ll show you an object-oriented version (a Life class) along with some other tweaks to make things look nicer.

**03**
*Sunday*
May 2020

Posted Fun

inYou may have heard that mathematician **John Conway** died last April. To his everlasting dismay, most people only know him for his “game” of **Life** (which he considered trivial and inferior to his real mathematical work). Unfortunately for Conway, his Life game is fascinating.

To honor his passing, I whipped up a Python version that I thought I’d share. Python is about the only language I’ve used a lot in which I’ve never implemented Life, so high time I did, right?

**25**
*Saturday*
Apr 2020

Posted CS101

in**Tags**

Aspect-Oriented Programming, computer language, programming language, Python, Python code, Python decorator

Last time I began exploring Python decorators, which are a way of having one function “wrap” another function. Because the wrapper has access to both the input parameters and the return value, it can modify these values (unbeknownst to the inner function).

This time I pick up where I left off by exploring decorators modifying return values, decorators that take parameters, and decorators in classes.

**24**
*Friday*
Apr 2020

I’ve been playing around with what **Python** calls *decorators*. They’re a built-in way of implementing Aspect-Oriented Programming techniques in Python. In fact, they’re quite powerful.

Since they aren’t a common language feature, they can be a little confusing at first, so I thought I’d try my hand at laying out how they work.

**22**
*Wednesday*
Apr 2020

I saw a video recently about function currying, and it triggered the realization that currying might solve a problem I’ve been pondering in the context of language parsing. The problem involves knowing how many arguments an operator expects, what’s called the arity of an operation or function. It can vary from zero to many.

But it occurred to me that, with currying, there could be a language where operations always take just one argument. And that would solve a challenge for a mathematical expression language I have in mind.

**19**
*Sunday*
Apr 2020

Posted CS101

in**Tags**

code clarity, computer programming, operator precedence, order of operations, parentheses, readable code, software design

Enough stories, time for a new rule. Which is to always use parentheses in all except the simplest of math expressions. Languages have a precedence protocol, so the compiler can figure it out, but human readers may be confused.

As always, the underlying motivation involves code clarity for other humans reading the source code — the most important rule of all.