Skip to content

Entries published on December 4, 2007

1 entry published on this date. See also: all entries published in December 2007, full archive.

The magic of template tags

Over the last couple days I’ve spent some time discussing the word “magic” and exploring just what it really means, with an emphasis on the fact that a lot of “magic” in programming — though initially counterintuitive and not at all what you’d expect to have happen (and it’s precisely this reason which usualy makes “magic” a bad idea) — boils down to applications of fairly simple principles. As a real-world demonstration of that, yesterday we saw how to build a Python module object dynamically and make it work with import even though it didn’t exist anywhere on the file system.

When I mentioned Django’s “magic-removal” effort the other day, I mentioned that it didn’t quite purge all of the “magic” from Django:

there’s still a minor amount of magic in how custom template tags work, but it’s not nearly so bad and most people never even notice it (until they …

Entry published December 4, 2007. Read full entry.