Tag Archives: Python

Collision: the story of the random bug

So here I was, trying to write some Django server-side code, when every once in a while, some test would fail. Now, it is important to know that we are using any_model, a cute little library that allows you to … Continue reading

Posted in Python | Tagged , , , , , | 2 Comments

Cheap language detection using NLTK

Some months ago, I was facing a problem of having to deal with large amounts of textual data from an external source. One of the problems was that I wanted only the english elements, but was getting tons of non-english … Continue reading

Posted in Python | Tagged , , , , | 3 Comments

Python Module Usage Stats – Feb 2011

Here are the top 30 “base modules”, ordered by number of PyPI projects importing them. These results are based on 11,204 packages download from PyPI. Explanations, full results and code to generate them are available below. Continue reading

Posted in Python | Tagged , , , | 9 Comments

Beautiful Code

A few days ago, @edensh mentioned in Facebook beautiful code, and many people gave examples of assembly, while I was thinking of Python. That got me thinking: what is beautiful code for me? So here are my criteria for beautiful … Continue reading

Posted in Programming Philosophy | Tagged , , , , | 2 Comments

Small programming challenge No. 6 – nblocks

I came up with this challenge when I had to write a function to divide a sequence to percentiles. I needed this to calculate some statistics over trips for plnnr.com. “This sounds trivial” I thought, and reached for my simple … Continue reading

Posted in Challenges, Programming, Python, Statistics | Tagged , , , , | 21 Comments

One-liner Guitar Tuner in Python

On windows, assuming imports are free: import winsound winsound.Beep(220*((2**(1/12.0))**7), 2000) But that’s just because I like to tune to E. If you prefer a more “natural looking” note, you can use A: winsound.Beep(110, 1000) But why choose at all when … Continue reading

Posted in Python, Sound | Tagged , , , | 2 Comments

Visualizing Data Using the Hilbert Curve

Some time ago, a coworker asked me to help him visualize some data. He had a very long series (many millions) of data points, and he thought that plotting a pixel for each one would visualize it well, so he … Continue reading

Posted in Fractals, Graphics, Math, Programming, Python | Tagged , , , | 2 Comments

Fuzz-Testing With Nose

A few days ago, I found a in my website, plnnr.com. The bug was in a new feature I added to the algorithm. The first thing I did was write a small unit-test to reproduce the bug. With that unit-test … Continue reading

Posted in Python, Testing | Tagged , , , | 3 Comments

Pyweb-il Presentation on Optimization Slides

Last Monday I gave a presentation in pywebil on optimization, that’s loosely based on my blog post on the same subject. Here are the slides for that presentation.

Posted in Optimization, Programming, Python | Tagged , , , | Leave a comment

Call for Volunteers: Open Knesset – oknesset.org

Over the last few weeks, I’ve been lightly involved in work on open knesset. Mostly I’ve been helping two of the main developers, Benny and Ofri, and joining the discussions on the discussion group. (For the non-Israelis: the Knesset is … Continue reading

Posted in Projects | Tagged , , , | 2 Comments