Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: time, calendar, datetime, etc

Reply
Thread Tools

Re: time, calendar, datetime, etc

 
 
Ben S
Guest
Posts: n/a
 
      07-31-2003
Steven Taschuk wrote:
> Quoth Kylotan:
> [...]
>> And does datetime.timetuple() actually return something equivalent to
>> a struct_time as used by the time module? At first glance this looks
>> to be true, but it isn't clearly documented as such.

>
> Isn't it?
>
> timetuple()
> Return a 9-element tuple of the form returned by
> time.localtime().
>
> <http://www.python.org/doc/current/lib/datetime-datetime.html>


Problem is, time.localtime() doesn't return a 9-element tuple any more,
it returns a struct_time. (Since 2.2, I think.)

--
Ben Sizer
http://pages.eidosnet.co.uk/kylotan


 
Reply With Quote
 
 
 
 
John Roth
Guest
Posts: n/a
 
      07-31-2003

"Ben S" <(E-Mail Removed)> wrote in message
news:bgaphh$lua$(E-Mail Removed)...
> Steven Taschuk wrote:
> > Quoth Kylotan:
> > [...]
> >> And does datetime.timetuple() actually return something equivalent to
> >> a struct_time as used by the time module? At first glance this looks
> >> to be true, but it isn't clearly documented as such.

> >
> > Isn't it?
> >
> > timetuple()
> > Return a 9-element tuple of the form returned by
> > time.localtime().
> >
> > <http://www.python.org/doc/current/lib/datetime-datetime.html>

>
> Problem is, time.localtime() doesn't return a 9-element tuple any more,
> it returns a struct_time. (Since 2.2, I think.)


Strictly speaking, that's true, but the object that's returned
*acts* like a sequence of 9 integers if you reference it properly.
It seems like 2.2 did this in a number of places, so that you
could reference values by name. I like the thinking behind it.
It's a lot better documentation if you want to get one value at
a time.

John Roth

>
> --
> Ben Sizer
> http://pages.eidosnet.co.uk/kylotan
>
>



 
Reply With Quote
 
 
 
 
Steven Taschuk
Guest
Posts: n/a
 
      08-01-2003
Quoth Ben S:
[...]
> Problem is, time.localtime() doesn't return a 9-element tuple any more,
> it returns a struct_time. (Since 2.2, I think.)


Ah, yes. I read Kylotan's question pretty sloppily, it seems.

datetime.timetuple() does indeed return a struct_time, as do
date.timetuple() and datetime.utctimetuple(), and this is clearly
desirable and intended. I think I'll submit a doc patch.

--
Steven Taschuk o- @
http://www.velocityreviews.com/forums/(E-Mail Removed) 7O )
" (

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: PIL (etc etc etc) on OS X Kevin Walzer Python 4 08-13-2008 08:27 AM
there are too many warnings (you are about to....etc etc forever) after installing Firefox trevor_smithson@yahoo.com Firefox 2 10-13-2005 07:35 PM
user authentication via /etc/passwd|/etc/shadow Marco Herrn Python 7 04-09-2004 12:12 PM
Python Audio (Alpy, Fastaudio, Etc Etc) Daniel Joyce Python 1 09-16-2003 08:39 PM
Is there a standard module library function to access /etc/passwd or /etc/group Robin Cull Python 5 07-31-2003 09:35 PM



Advertisments