[Python-ideas] Top 10 Python modules that need a redesign Was: Geo coordinates conversion in stdlib
Alexander Belopolsky
alexander.belopolsky at gmail.com
Fri Mar 27 17:55:36 CET 2015
On Fri, Mar 27, 2015 at 12:13 PM, anatoly techtonik <techtonik at gmail.com>
wrote:
>
> Here is something that can be used as an example that it is not about
PEP8 https://code.google.com/p/rainforce/wiki/WartsOfPython#measure_time
And it takes a lot of energy to collect something like that for the
reference.
Well, in that document, I see the total of four "warts" related to the
datetime module. If four warts bring a module to the top of the "worst
designed stdlib modules" list, it can only mean that stdlib is almost
perfect!
For each "wart" the author has a "What can be done?" section, but no
suggested solution involves a major redesign of the datetime module.
The author complains about non-obviousness of strftime and indeed, for
users without C background, neither name nor semantics is familiar. But
the proposed solution
>>> time.format('{{hours}}:{{minutes}}:{{seconds}}', 1090)
'00:18:10'
Does not look like a big win over the already available solution:
>>> '{t.hour}:{t.minute}:{t.second}'.format(t=datetime.now())
'12:37:38'
Overall, while I agree that there are a few warts in the datetime module, I
have not seen any serious enough to warrant a major redesign or even any
non backward compatible changes. Maintaining backward compatibility in the
datetime module is indeed non-trivial, but this is the way I think it
should be developed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150327/daceda25/attachment-0001.html>
More information about the Python-ideas
mailing list