This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, r.david.murray, techtonik
Date 2010-06-11.04:02:55
SpamBayes Score 0.00042650124
Marked as misclassified No
Message-id <AANLkTikJf3xRdpP6IqefM9O4p03Eh0Ij6xwUR54mEKlj@mail.gmail.com>
In-reply-to <1276223876.5.0.119131670429.issue8903@psf.upfronthosting.co.za>
Content
On Thu, Jun 10, 2010 at 10:37 PM, R. David Murray
<report@bugs.python.org> wrote:
>
> R. David Murray <rdmurray@bitdance.com> 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.
History
Date User Action Args
2010-06-11 04:02:57belopolskysetrecipients: + belopolsky, techtonik, r.david.murray
2010-06-11 04:02:55belopolskylinkissue8903 messages
2010-06-11 04:02:55belopolskycreate