Author Archives: Steve Ferg

Workaround for flask/babel/sphinx bug on Python 3+

I’m using Python 3.4 on Windows. Recently I tried to install and use Sphinx.  When I did, I encountered an error that ended with the string an integer is required (got type str) Googling that string, I found an explanation … Continue reading

Posted in Python features

enum in Python

Recently I was reading a post by Eli Bendersky (one of my favorite bloggers) and I ran across a sentence in which Eli says “It’s a shame Python still doesn’t have a functional enum type, isn’t it?” The comment startled … Continue reading

Posted in Python features | 8 Comments

Python Decorators

In August 2009, I wrote a post titled Introduction to Python Decorators. It was an attempt to explain Python decorators in a way that I (and I hoped, others) could grok. Recently I had occasion to re-read that post. It … Continue reading

Posted in Decorators | 32 Comments

Unicode – the basics

An introduction to the basics of Unicode, distilled from several earlier posts. In the interests of presenting the big picture, I have painted with a broad brush — large areas are summarized; nits are not picked; hairs are not split; … Continue reading

Posted in Unicode | 3 Comments

Python’s magic methods

Here are some links to documentation of Python’s magic methods, aka special methods, aka “dunder” (double underscore) methods. Rafe Kettler’s A Guide to Python’s Magic Methods ::—> Michael Foord’s chapter on Python Magic Methods from this book IronPython in … Continue reading

Posted in Python features | 2 Comments

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

Unicode for dummies — Encoding

Another entry in an irregular series of posts about Unicode. Typos fixed 2012-02-22. Thanks Anonymous, and Clinton, for reporting the typos. This is a story about encoding and decoding, with a minor subplot involving Unicode. As our story begins — … Continue reading

Posted in Unicode | 5 Comments