Alexander Belopolsky <[email protected]> added the comment:
On Thu, Jun 10, 2010 at 10:37 PM, R. David Murray <[email protected]> wrote: > > R. David Murray <[email protected]> added the comment: > > I actually agree with Anatoly here. I find it much more intuitive to do > > import datetime > > timestamp = datetime.now() > > than to do > > timestamp = datetime.datetime.now() > Given the unfortunate name clash between the class and the module, I never do "import datetime" and instead doe "from datetime import datetime, date". I find it very convenient that importing datetime class brings in all related functions and I don't need to import factory functions separately. Also, ISTM that the datetime module was designed to allow easy extension by subclassing. The factory methods are written so that they work for subclasses: ... pass >>> Date.today() Date(2010, 6, 10) Writing a separate module level today() for the subclass would be quite awkward. ---------- _______________________________________ Python tracker <[email protected]> <http://bugs.python.org/issue8903> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
