Daw-Ran Liou

Software Developer, Clojurist, Pythonista @ SF

Closures bind late

2017 February 18

“Closure is a turtle carrying its shell,” my favorite explanation 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 explain it very well. The bridge is just a simple sentence, “closures bind late.”

Read more…

Generator - The Basics

2017 January 7

I’ve been wanting to write articles about generators for quite some time. Generator is definitely one of my favorite features in Python. Ever since I stopped treating Python like other programming languages, e.g. Java or C++, I start having so much fun writing codes. Unlike other very powerful features (decorators, context managers, or classes) that I sometimes abused a lot, Generators don’t ever seemed to be too much in my code. They have strong purpose in the code, and are very beautiful in the codes. In this article, I’ll explain the basics things about generators. At the end, I’ll show you how to use it to solve some problems.

Read more…

40 Books I Read in 2016

2017 January 4

I challenged myself to read 10 books this year and I ended up reading 40 of them. Phew. What a great year, 2016! I really picked up this new-found hobbit of reading. Feel free to add me friends on Goodread to see which book I’m currently reading. Let’s read more! Here’s my top 5 picks in 2016:

  1. Mistborn: The Final Empire (#33)
  2. Soft Skills - The Software Developer’s Life Manual (#2)
  3. The 4-hour Work Week (#29)
  4. The Martian (#14)
  5. Ready Player One (#15)

Read more…

You probably don't need for loops

2016 November 17

Originally titled “Never Write For-loops again”

This is a challenge. I challenge you to avoid writing for-loops in every scenario. Also, I challenge you to find the scenarios that are so freaking hard to write anything else but a for-loop. Please share your findings. I’d like to hear about them.

It’s been a while since I started exploring the amazing language features in Python. At the beginning, it’s just a challenge I gave myself to practice using more language features instead of those I learned from other programming language. And things are just getting more fun! Not only the code become shorter and cleaner, but also code looks more structured and disciplined. I’ll get into those benefits more in this article.

Read more…

Completed my first hackathon!

2016 March 10

It was such a amazing experience. There’s no such thing that make you, and your teammate pull a all-nighter and still gives you one of the best times of your life, except hackathon. (Hackathon rocks!) I want to share with you what it was like, if you don’t already know, and some thoughts about it.

My company started its first ever hackathon last Thursday at 8 am. All submission were done on Friday, 12 pm and the whole afternoon is for presentations and demonstrations. The basic idea of hackathon: it is a project competition that’s done during days of marathon-like intensive working/hacking. Participating teams get unlimited supplies of coffee and red bulls. Indeed this sounds very terrifying.

Read more…

Practical Uses of Python AND and OR Boolean Operators

2016 March 2

In my previous post — Python Truth Value Testing is Awesome, I mentioned about the sweet combo of the truth value testing and the boolean operators, and gave an example for it using the or-operator. One of my colleagues gave me a comment that the or-operator all seems legit, but the and-operator seems pretty anti-intuitive. This raise the question in me: is there any practical example of using the and-operator which also takes the advantage of the generic truth value testing? Here’s what I found.

Read more…

Python Truth Value Testing is Awesome

2016 February 25

I’m constantly amazed by the simplicity and readability Python provides. (See The Zen of Python.) As the industry evolves, more and more codes written each day, how to read code fast is a rising question every developer would face. Imaging the times when you faced a new code base and need to ramp up the knowledge in order to work with it. Lot’s of reading, isn’t it? This is why I think Python is a great modern programming language. Let’s talk about one of the features Python provides — the truth value testing.

Read more…

Flask for New Web Developer

2016 February 18

Last long weekend after my geek marathon I finally finished reading Flask Web Development: Developing Web Applications with Python and deployed my blog app on Heroku. It was such rewarding to see my web app running online, not only as a novice web application developer but also as a adventurer to this whole new world of DevOps. In this article I want to share some thoughts mostly about Flask — the Python framework for web developing — , and covers a little about what I’d recommend a beginner to start building web apps, and a little bit about the book.

Read more…