[Python-ideas] Pythonic Dates, Times, and Deltas

Dag Odenhall dag.odenhall at gmail.com
Thu Oct 14 00:16:32 CEST 2010


On Wed, 2010-10-13 at 16:04 -0400, Daniel G. Taylor wrote:
> Hey,
> 
> I've recently been doing a lot of work with dates related to payment and 
> statistics processing at work and have run into several annoyances with 
> the built-in datetime, date, time, timedelta, etc classes, even when 
> adding in relativedelta. They are awkward, non-intuitive and not at all 
> Pythonic to me. Over the past year I've written up a library for making 
> my life a bit easier and  figured I would post some information here to 
> see what others think, and to gauge whether or not such a library might 
> be PEP-worthy.
> 
> My original post about it was here:
> 
> http://programmer-art.org/articles/programming/pythonic-date
> 
> The github project page is here:
> 
> http://github.com/danielgtaylor/paodate
> 
> This is code that is and has been running in production environments for 
> months but may still contain bugs. I have tried to include unit tests 
> and ample documentation. I'd love to get some feedback and people's 
> thoughts.
> 
> I would also love to hear what others find is difficult or missing from 
> the built-in date and time handling.
> 
> Take care,
> 

Not convinced your library is very Pythonic. Why a tuple attribute
instead of having date objects be iterable so you can do tuple(Date())?

How does the fancy formats deal with locales?

Is there support for ISO 8601? Should probably be the __str__.

+1 on the general idea, though.




More information about the Python-ideas mailing list