3 ms·
> 0-based is much easier to work with internally. Why's that?
by lexicality 5y ago
> 0-based is much easier to work with internally.
Why's that?
- petepete 5y agoEven 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.
- globular-toast 5y agoMainly 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.