Hacker News new | ask | show | jobs
by lexicality 1821 days ago
> 0-based is much easier to work with internally.

Why's that?

2 comments

Even if it was I'd still want days and months to start at one and, you know, match everything else in existence that represents them.
Mainly because you can use normal modulo arithmetic and use them as array indices.

But as I mentioned in another comment, really you should be touching the internals of the datetime object at all. It's a mistake to do something like `myDatetime.day += 1`. You should instead do `myDatetime + timeDelta(days=1)` or something.

So it shouldn't matter whether it's 0-based or 1-based at all. But since it apparently does (I don't know why), then it might as well by 0-based like everything else.