Re: [Python-Dev] Curious datetime method

2010-07-21 Thread Anders Sandvig
On Tue, Jul 20, 2010 at 5:56 PM, Alexander Belopolsky wrote: > In the real world where we have to take backward compatibility into > account, I would like to make today() and now() to be the same: both > taking optional tz argument, both available as either date or datetime > methods and both cova

Re: [Python-Dev] Curious datetime method

2010-07-20 Thread Alexander Belopolsky
On Tue, Jul 20, 2010 at 9:57 AM, Anders Sandvig wrote: >> I wonder why would anyone want to use datetime.today() instead of >> datetime.now()? > > Because this method is also present in datetime.date. Thus, you can > reference stuff like  d.today().day without caring whether d is a date > or a dat

Re: [Python-Dev] Curious datetime method

2010-07-20 Thread Anders Sandvig
> I wonder why would anyone want to use datetime.today() instead of > datetime.now()? Because this method is also present in datetime.date. Thus, you can reference stuff like d.today().day without caring whether d is a date or a datetime object. Anders __

[Python-Dev] Curious datetime method

2010-07-16 Thread Alexander Belopolsky
I always thought that date.today() was a date class method and its availability as a datetime method was an artifact of datetime inheritance from date. I thought datetime.today() would be just the same as date.today(). It turned out I was wrong. Instead, datetime.today() is more like datetime.no