Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the python datetime module, timedelta objects take weeks, days, hours, minutes, seconds, and microseconds as arguments upon instantiation. However, after the timedelta is created, the only two attributes it has of the former listed are days, seconds, and microseconds.

Why is this?

share|improve this question
up vote 1 down vote accepted

Probably to keep the size of the object small. In the documentation is clearly stated that all the arguments are converted into those three units.

share|improve this answer
It's weird to me that there aren't @property methods that calculate minute, hour, etc. for you on access, but thanks for the help. – notbad.jpeg Aug 22 '13 at 22:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.