Tag Archives: Python

Introduction to Python Decorators

This post was originally written in August 2009. Since then, I have come to believe that there is a much better way to explain Python decorators, which I describe in another post. Writing introductions to decorators is a popular pastime … Continue reading

Posted in Decorators | Tagged | 3 Comments

Gotcha — forgetting parentheses

Goto start of series In Python, omitting the trailing parentheses from the end of a method call (one that takes no arguments) is not a syntax error. The place where this most frequently bites me is with the “close” method … Continue reading

Posted in Python gotchas | Tagged | 4 Comments

Gotcha — backslashes in Windows filenames

Goto start of series Once upon a time there was a beautiful Windows programmer named Red Ridinghood. One day, Red’s supervisor told her that they were going to start building a new application called GrandmasHouse. The feature list for the … Continue reading

Posted in Python gotchas | Tagged | 11 Comments

Gotcha — backslashes are escape characters

Goto start of series This is a language feature that is so common on Unix that Unix programmers never think twice about it. Certainly, a Unix programmer would never consider it to be a gotcha. But for someone coming from … Continue reading

Posted in Python gotchas | Tagged | 4 Comments

Python Gotchas

What is a “gotcha”?The word “gotcha” started out as the expression “Got you!” This is something that someone who speaks idiomatic American English might say when he succeeds in playing a trick or prank on someone else. “I really got … Continue reading

Posted in Python gotchas | Tagged | 4 Comments