2 ms·
> An application may be designed in such a way that all dates and times are in a single timezone that is known in advance. In this case there is no need for ind
by arp242 3y ago
> An application may be designed in such a way that all dates and times are in a single timezone that is known in advance. In this case there is no need for individual datetime instances to carry their own timezones, since this uses more memory and processing power for no benefit, since all these timezones would be the same and it would never be necessary to perform timezone math or conversions.
The memory and processing differences between the two seem marginal, at best. Especially when it's at UTC ("plus zero" doesn't take too much processing).
So I'm gonna have to ask for benchmarks on this one.
And even if it was slower one must ask if having a confusing concept like a naïve datetime is worth it. Obviously Python is all about the "programmer productivity at the expense of some performance" trade-off.
- remram 3y agoYeah, both None and UTC are singletons so there should be exactly 0 difference in memory usage between a datetime with tzinfo=None or tzinfo=UTC.