2009-07-30

Results of informal poll about the standard library

A week ago I posted an informal poll asking what modules from the standard library needed a redesign. I did this out of personal curiosity to see what modules people used but thought could stand to be improved.

The results are somewhat interesting, especially when you take into account that Python 3 is the future and a lot of standard library consolidation occurred for it. Take, for instance, the winner at the moment which is "conslolidate(urllib, urllib2, httplib)". This is actually unwarranted as Python 3.0 fixed this with the http package. So most desired changed already happened. Go us!

The second one is datetime. Now I for one, do not see what is wrong with the module. It does not follow PEP 8 naming standards which is a frequent complaint I hear. But otherwise I personally do not see the problem. I asked on Twitter what issues people had and none of them really turned out to hold when you think about it. For instance, someone said they wanted to be able to subtract a time object from a datetime object. But that makes no sense as a time object simply reflects a point in time for any day. What this is asking for is to either subtract an amount of time represented by the time object or to assume the time object is for today. The former makes no sense as a time object is a point in time for an arbitrary day, which means you can't find the time delta as you don't know what day you are working on. But if you want a time object to implicitly represent today for mathematical reasons I would point out how the word "implicit" came into this. Python doesn't like implicitness. If you wanted the time to be for today then you should create a datetime object for today with the time set to your time object (which is not hard to do).

Basically every person who has ever told me that datetime needs work can never give me a concrete way to improve it or wants it to make assumptions that do not universally hold for everyone or make real sense when you think it through. So I consider this a side-effect of working with date and time being extremely difficult and a complete pain and people just wanting less pain somehow.

Coming in third place is logging. Now here is a package that I have never heard anyone say they thought was perfectly designed. While everyone is glad to have the package, it is rather obvious there is a Java heritage to the design. The package was added in Python 2.3, which puts it at the cusp of major changes in Python such as decorators and before other things such as context managers ('with' statements), the new I/O library, etc. There is even a chance that this poll is going to inspire someone to actually come up with an alternative. But as with all new modules wanting to come into the standard library, it will need to existed for at least a year and have become the best-of-breed solution as considered by the community before we can consider including some logging reboot.