Latest blog posts
Where I write about things like Python, Django, JavaScript and Linux.
I haven't yet posted here about my project nanodjango. If you haven't heard of it yet, it is a package which lets you write Django in a single file. I gave a lightning talk at Djangocon US and have written an introductory blog post over at Lincoln Loop, if you want to find out more from a user's perspective - but here I'm going to talk about how it works.
A couple of years ago I took over yet another project where the previous developers had heard "Flask is easier than Django", and I saw they had ...
Read full post
Continuing on from the previous post about decorators, we should visit metaclasses before we get to the good stuff.
For those who haven't worked with them, metaclasses are essentially invisible decorators for classes.
The metaclass describes how your class is made. You define a base class with a custom metaclass, then every class which inherits from your base class will have the same metaclass.
Whereas a normal class's __init__
method will let you control what happens when your class is instantiated, the __init__
method on a metaclass will let you control what happens when your class is defined ...
Read full post
I enjoy doing silly things with code - having an idea that makes me chuckle and then figuring out how to make it happen. These are often fun diversions, an exercise in pushing my limits and Python's - but sometimes they turn into proper projects which I release, other people use, and I then need to maintain. As a result, a lot of my projects harbour a dark secret or two, and I've used a lot of techniques to hide them away and protect my users from the troubles they can bring. I'm going to talk about these techniques ...
Read full post
I've just given a talk at PyCon UK, called Syntactic Sugar vs Maintainability, looking at balancing helping your users at the cost of your sanity.
The synopsis was:
Is it ever worth committing coding sins for the greater good? We'll look at techniques which can make your code easier to use at the cost of being harder to maintain, and when the effort is worth the reward.
There are plenty of ways in which you can use and abuse the power of python to make your library code easier for your users to work with. I'm going ...
Read full post
Tagulous v0.13.0 is now available - it adds support for Django 1.11 and addresses several issues - see the changelog for full details.
Note that to support for Django 1.11, the names of automatically generated tag models has had to change - they're no longer allowed to start with an underscore. There is a simple fix, but this version does therefore require additional upgrade steps - see the upgrade notes for more information.
Read full post