After reading Brandon Sanderson’s State of the Sanderson 2018 and Fogus’s The best things and stuff of 2018, I feel like to write up a quick summary my year of 2018, a part for myself, and a part for the reason I’ll explain later in the post.

The same article is also shared on my personal website: I haven’t figured out why I need both places to share my contents but at the meanwhile feel free to check it out 😎

Some Numbers in 2018

  1. 280 Open Source Software contributions
  2. 11.9K Total viewership over the 5 articles I published on Medium
  3. 40 Books

If you are interested for the recipe only, please scroll down to the recipe section.


That is, there are numerous of times, and this even happened to myself when I was new, that multiple Pythons that came from different sources were mingled in the machine, waiting eagerly to teach someone a hard lesson.

“Why do you have so many Python runtimes?”

Personally, I have a Mac. There are some possible sources for my Python runtimes:

  1. System Python
  2. official installer
  3. Homebrew
  4. Anaconda/miniconda
  5. Compiled Python from source tarball
  6. Pyenv

With all these, it’s really confusing to tell which Python my…

The inspiration of this article came from the Cousera course, Functional Programming in Scala. I basically translate the Scala program in section 6 into the Clojure version you’re about to see. Kudos to Martin Odersky.

Photo by James Sutton on Unsplash

You might have seen ads with interesting phone numbers like: 1–800-FLOWER, 1–800-FREE-411, or 1–800-GOT-JUNK. Those are called phonewords, or mnemonic phone numbers. It’d be awesome to have a memorable phone number like 1–RANDY-DA-MAN. However, maybe your phone number already has a meaning. How cool is it to figure it out, well, using Clojure?

Let’s clarify the problem. What we want is to: find all the…

It not only seems that the lazy programmer gets the job, but also the lazy programs these days. I first encounter Python’s laziness in my discovery of Python’s usages of generators. This is especially true in modern Python, a.k.a. Python 3, where lots of functions return generators in favor of lists. I found them to be extreme useful for those one-off lists to iterate on.

Lately I started teaching myself Clojure, a dialect of the Lisp programming language. Yet again I was astound by the usage of laziness in programming languages. Lazy evaluation is actually quite a normal thing in…

Have you ever had the feeling that you got so passionate about something that you have to share it to everyone around you? You gotta force people to be passionate about it, am I right? I was so thrilled about Python two years ago, on the day I finally understood what list comprehension is. I had never knew programming could be so… enjoyable. Gradually from chit-chatting with colleagues, to going to a local meetup group and writing blog posts, I wish to find yet another way to share this amazing technology and to help people. …

Imaging you are given a brand new web project, some vague requirements, and a ton of freedom to choose the technical stacks, will you take it? My answer while a couple of months back was… “Hell yeah!” Even though I had never really worked on a real-world project except the blog app that was taught a thousand times from online tutorials.

It had been a wonderful journey, with struggles, of course. I would love to share what I learned. Hope it sheds some lights on your coding journey too. …

Sharing the recipe of composing namedtuple from namedtuples.

The problem:

One namedtuples is great, two better. But how do I combine the two namedtuples to get the best nametuple of all?

For example, how to combine the Square class with Color class?

Square = namedtuple('Square', 'x0 y0 x1 y1')
Color = namedtuple('Color', 'r g b')
# The opposite of DRY principle - WET (we enjoy typing) principle
ColoredSquare = namedtupe('ColoredSquare', 'x0 y0 x1 y1 r g b')

I don’t like this solution, because there are clearly something to reuse in Square and Color , and also, it isn’t fun to…

American football players “blocking” the kick, not “intercepting.”

This article is also cross-shared to and my blog.

Special thanks to Luciano Ramalho. I learned most of the knowledge about descriptors from his workshop in PyBay 2017

Have you seen this code or maybe have written code like this?

from sqlalchemy import Column, Integer, String
class User(Base):
id = Column(Integer, primary_key=True)
name = Column(String)

This code snippet partially comes from the tutorial of a popular ORM package called SQLAlchemy. If you ever wonder why the attributes id and name aren't passed into the __init__ method and bind to the instance like regular class does. …

This article is a summary of what I learned from Philip Guo’s CPython internals: A ten-hour codewalk through the Python interpreter source code. I highly recommend his course. He go through great materials in his videos. You can think of this article as a companion text version of his course, so you can come back for your own references. The only major difference between Philip Guo’s course and this article is the Python version. In his course he was using 2.7.8. This article I’m using the 3.6.0 sourcecode. …

This post is originally shared on my personal blog. If you have trouble reading the code examples, please make sure to check out my blog. I have syntax highlighting there.

“Closure is a turtle carrying its shell,”

My favorite explaination to closures, quote by Raymond Hettinger. With closures, lots of great features are possible in Python like higher order functions and decorators.

I came across this StackOverflow post — How can I return a function that uses the value of a variable?, which helped me bridging the gap in my knowledge, the gap that I sort-of understood it but couldn’t…

Daw-Ran Liou


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store