Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.