Re: [Python-Dev] Curious datetime method

2010-07-21 Thread Anders Sandvig
On Tue, Jul 20, 2010 at 5:56 PM, Alexander Belopolsky alexander.belopol...@gmail.com 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

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

Re: [Python-Dev] Curious datetime method

2010-07-20 Thread Alexander Belopolsky
On Tue, Jul 20, 2010 at 9:57 AM, Anders Sandvig anders.sand...@gmail.com 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

[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