Python Tips and Traps

“Python (and its libraries) are enormous. It is used for system automation, web applications, big data, analytics, and security software. This article aims to show off some lesser-known tricks to put you on the path to faster development, easier debugging, and general fun.

As with every language, the real resource you get once you learn it isn’t a language-related superpower. It’s the ability to use the idioms, libraries, and shared knowledge of the Python community…”


Command-line tools can be 235x faster than your Hadoop cluster

“As I was browsing the web and catching up on some sites I visit periodically, I found a cool article from Tom Hayden about using Amazon Elastic Map Reduce (EMR) and mrjob in order to compute some statistics on win/loss ratios for chess games he downloaded from the millionbase archive, and generally have fun with EMR. Since the data volume was only about 1.75GB containing around 2 million chess games, I was skeptical of using Hadoop for the task, but I can understand his goal of learning and having fun with mrjob and EMR. Since the problem is basically just to look at the result lines of each file and aggregate the different results, it seems ideally suited to stream processing with shell commands. I tried this out, and for the same amount of data I was able to use my laptop to get the results in about 12 seconds (processing speed of about 270MB/sec), while the Hadoop processing took about 26 minutes (processing speed of about 1.14MB/sec)…”

A modernized and annotated code companion to Paul Graham’s “On Lisp”

“This repository contains a version of the code from On Lisp modified for use in modern Lisp environments. Paul Graham’s original code can be found here.

Among other necessary changes, this version:

  • Updates code that relied on pre-ANSI built-ins
  • Includes the bug fixes mentioned on pg’s errata page
  • Organizes everything into a modern system structure with ASDF and named-readtables
  • Adapts most of the example code into test suites
  • Makes it easy to load each version of the query system, Prolog system, and OOP system separately

It was written to follow along with the book page by page and catalogue dependencies between the chapters, which become quite complex toward the end.

The PDF file of the book available from Paul Graham’s site isn’t so great for reading on a screen. A version with smaller margins and the missing figures re-added can be found here. Figure 20.2 is missing a line between 2 and 3.

An online HTML version of the book, minus graphical figures, can be found here.

If you’re using CLISP, clone the ahead-of-Quicklisp version of lisp-unit2 to load the test code…”

A Quick Comparison of Nim vs. Rust

Rust and Nim are the two new programming languages I have been following for a while. Shortly after my previous blog post about Rust, Nim 0.10.2 was out. This led me to take a closer look at Nim, and, naturally, compare it with Rust.

In this blog post, I’m going to share my two simple examples written in Nim and Rust, the rough execution time comparison, and my subjective impressions of coding in both…”

60sec Review: Rust Language

“Rust is different. Rust is a statically typed compiled language meant to target the same tasks that you might use C or C++ for today, but it’s whole purpose in life is to promote memory safety. By design, Rust code can’t have dangling pointers, buffer overflows, or a whole host of other memory errors. Any code which would cause this literally can’t be compiled. The language doesn’t allow it. I know it sounds crazy, but it really does work…”