Category Archives: Python gotchas

Gotcha — Mutable default arguments

Goto start of series Note: examples are coded in Python 2.x, but the basic point of the post applies to all versions of Python. There’s a Python gotcha that bites everybody as they learn Python. In fact, I think it … Continue reading

Posted in Python gotchas | 6 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