Category Archives: Python

And now for something completely different

My friend Yuval whom you might already know from the comments here, apparently composed music for the Python Zen. It made me laugh today, and as it’s been a long day, I thought it’s worth sharing here. Especially as it … Continue reading

Posted in Humour, Python | Tagged , , , | Leave a comment

Leaky method references

After reading my last post regarding __del__, you should know that __del__ + reference cycle = leak. Let’s say that you do need to use __del__, so you decide to avoid reference cycles. You write your code in such a … Continue reading

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

Python Gotchas No. 2: Garbage Collection Oddities

Python is a garbage collected language. The garbage collector will collect orphaned objects. These are objects that have no references. If an object has a __del__ method, it will be called when that object is collected. Note however, that there … Continue reading

Posted in Programming, Python | Tagged , , , | 1 Comment

PyWeb-IL presentation: Advanced subjects in Python

Yesterday I gave a presentation at PyWeb-IL, which took place at Google’s offices in Tel-Aviv. The presentation went really well, and interested many people. Here are the slides for the presentation, “Advanced Python Subjects”.

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

PythonTurtle delivers!

A few days ago, a coworker asked me what tool he should use to teach another non-programming coworker some programming. I thought a little, and suggested PythonTurtle, and then also demonstrated the builtin turtle. I thought nothing much of it, … Continue reading

Posted in Programming, Python, Teaching Programming | Tagged , , , | 1 Comment

Python Gotchas 1: __del__ is not the opposite of __init__

After discussing my last post with a friend and talking about a few other issues, we came to the conclusion that it would be worthwhile to discuss more gotchas. First though, what is a gotcha? Wikipedia gives a good definition: … Continue reading

Posted in gotchas, Programming, Python | Tagged , , | 6 Comments

GeneratorExit: another reason to upgrade to Python 2.6

Ever heard of GeneratorExit? Unless you write generators, and do some unusual stuff with them, you probably haven’t encountered it. GeneratorExit is a special exception that gets raised from within a generator when it is close()-ed. For example, consider the … Continue reading

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

Fast Peak Autocorrelation

So, I was at geekcon. It was a blast. There were many interesting projects, and I didn’t get to play with them all. I did get to work a bit on the Lunar Lander from last year, and this year … Continue reading

Posted in Algorithms, Math, Programming, Projects, Python, Utility Functions | Tagged , , , , , | Leave a comment

Preparing PyImprov for GeekCon on Friday

A long long time ago, I wrote Pytuner. It was one of the first projects I published on this website. For a long time it just sat there, doing nothing, while the library it’s based on – PyMedia, wasn’t being … Continue reading

Posted in Programming, Projects, Python, Sound | Tagged , , , | 3 Comments

10 Python Optimization Tips and Issues

Following my previous post on Optimizing Javascript, I thought I’d write a similar post regarding Python optimization.

Posted in computer science, Design, Optimization, Programming, Python | Tagged , , , , | 7 Comments