PyCon UK 2019

Syntactic sugar vs maintainability
09-13, 15:00–15:30 (Europe/London), Ferrier Hall

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.


Is your proposal suitable for beginners? – yes

Richard has been programming for 25 years, has been paid for it for 15, and has been using Python for 10. He is CTO at Wildfish, a London-based Python and Django consultancy, having previously been a freelancer, contractor and senior developer. Richard has worked on a wide range of projects, and enjoys solving challenging problems in interesting ways.