Syntactic Sugar vs Maintainability

  • python

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 to talk you through some techniques to design clean and simple library interfaces for your users, and explain how they can make things both easier and harder at the same time.

Using real world examples we'll touch on topics such as automatic registration using metaclasses; changing base classes at runtime to save your users a line of code; and the joys and pitfalls of monkey patching things which should probably never be monkey patched.

By the end of the talk you'll know why doing these things is usually a bad idea, and why I think it's worth doing them anyway.

I've also uploaded the slides and links to resources - if you came to listen, thanks very much! And if you didn't, the video should be up soon.

Leave a comment