[ python-Bugs-1087216 ] datetime module documentation missing critical detail

SourceForge.net noreply at sourceforge.net
Fri Dec 17 20:56:36 CET 2004


Bugs item #1087216, was opened at 2004-12-17 14:22
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1087216&group_id=5470

Category: Documentation
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Mike Meyer (mwm)
Assigned to: Nobody/Anonymous (nobody)
Summary: datetime module documentation missing critical detail

Initial Comment:
The datetime documentation - both pydoc and the manual - fail to
specify the arguments used to create a date/time/datetime object. The
manual implies that for date it's date(year, month, day), but that's
about it.

It would be nice if both could be extended to include examples. For date, say:

datetime.date(2004, 12, 25) - create a date object for christmas, 2004.

I can't give examples for time and datetime, because I'm not sure what
the format is.



----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2004-12-17 14:56

Message:
Logged In: YES 
user_id=31435

I'm not sure which docs you're looking at.  I'm looking at the 
Python docs <wink>, like here:

http://docs.python.org/lib/datetime-date.html

That seems very clear to me:

"""
class date(year, month, day) 

All arguments are required. Arguments may be ints or longs, in 
the following ranges: 

MINYEAR <= year <= MAXYEAR 
1 <= month <= 12 
1 <= day <= number of days in the given month and year 
If an argument outside those ranges is given, ValueError is 
raised. 
"""

There are equally precise docs for all the datetime.* classes.  
For example, you mentioned time:

"""
class time(hour[, minute[, second[, microsecond[, tzinfo]]]]) 

All arguments are optional. tzinfo may be None, or an 
instance of a tzinfo subclass. The remaining arguments may 
be ints or longs, in the following ranges: 

0 <= hour < 24 
0 <= minute < 60 
0 <= second < 60 
0 <= microsecond < 1000000. 

If an argument outside those ranges is given, ValueError is 
raised. All default to 0 except tzinfo, which defaults to None. 
"""

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1087216&group_id=5470


More information about the Python-bugs-list mailing list