pythonicity | pīˈTHänisədē |
  the quality of being Pythonic


A Paul Graham classic, the accumulator function.

As an illustration of what I mean about the relative power of programming languages, consider the following problem. We want to write a function that generates accumulators-- a function that takes a number n, and returns a function that takes another number i and returns n incremented by i.

Continue Reading

Map and Filter

Contrarian view on map and filter.

Although PEP 8 is silent on the topic, it's become recommended in many Python circles to eschew map and filter in favor of generator expressions or list comprehensions. For example, this Stack Overflow question received and accepted a typical response. Ironically, that question misquoted the google style guide

Continue Reading


The infamously simple FizzBuzz problem.

Reportedly a high percentage of programmer applicants can't solve this quickly.

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Continue Reading

Cheryl's Birthday

How to solve the Cheryl's Birthday puzzle programmatically.

  1. Albert and Bernard just became friends with Cheryl, and they want to know when her birthday is. Cheryl gave them a list of 10 possible dates:
     May 15     May 16     May 19
    June 17    June 18
    July 14    July 16
    August 14  August 15  August 17

    Continue Reading