[Tutor] Re: Could I have used time or datetime modules here?

Tim Peters tim.peters at gmail.com
Tue Dec 7 16:33:59 CET 2004

[Dick Moores]
> Brian, where did you learn about the ".seconds". And
> the .year, .month,.day of
> "alarm_datetime = datetime.datetime(now.year + 4, now.month,
>          now.day, alarm_hour, alarm_minute)"?
> Does this come from a general knowledge of OOP, or is it
> somewhere in the Python docs? The only thing I've seen, and it's
> not an explanation, is in note (1) on
> http://docs.python.org/lib/datetime-date.html

On that very page, the instance attributes of datetime objects are documented:

Instance attributes (read-only): 

Between MINYEAR and MAXYEAR inclusive. 

Between 1 and 12 inclusive. 

Between 1 and the number of days in the given month of the given year.

That's how you know that a datetime instance d has d.year, d.month and
d.day attributes, and how you know what they mean.  The docs for the
other datetime module objects have similar sections.

More information about the Tutor mailing list