If you've not read the blog post that explains why this library exists I recommend it. It's called "Ten Python datetime pitfalls, and what libraries are (not) doing about it" https://dev.arie.bovenberg.net/blog/python-datetime-pitfalls...
Whenever: Typed and DST-safe datetimes for Python
41–50 of 151 posts
Re: Whenever: Typed and DST-safe datetimes for Python
#42Then it would have been nice to see the benchmarks of the pure Python implementation as well. What if it's worse than arrow?
Re: Whenever: Typed and DST-safe datetimes for Python
#43Earlier quoted context omitted.
> I work in healthcare. If I have a choice between "reading docs/changelogs carefully, implementing functions", and "adding an extra dependency", I'm taking the dependency every single time. This kinda sums up the sorry state of software engineering. People can't even be bothered to read docs but will just blindly install a package just because someone was able to package it and upload it to PyPI. Taking on a depende…
> People can't even be bothered to read docs but will just blindly install a package just because someone was able to package it and upload it to PyPI. That's a straw man argument. No one said "blindly". You can very well carefully consider the pros and cons of adding a dependency and arrive at the conclusion that it makes sense. Many PyPI packages are in the Debian stable repositories, you could use that as an addit…
choice between "reading docs/changelogs carefully, implementing functions", and "adding an extra dependency"
which is what comment^ answers to, which to me actually sounds like that the added dependency comes in place of "reading docs/changelogs carefully".I think it matters a lot how much one can trust a 3rd party library, how much it is used, how much it is maintained etc. Moreover, it also matters how central and important this is to what you are actually doing, for example if the datetimes I come across are pretty much specific and with limited scope, I would probably care about reading docs less than if I am reading data with datetimes that may be totally wild. Furthermore, there are some libraries that are just considered the standard in some fields. If I use python I call pandas to read csvs, I am obviously not gonna write my own csv parser. It will also make your code more readable for others that already know and use the same libraries if they are so standard. But that's probably a very small minority of libraries that people actually use in certain languages.
Re: Whenever: Typed and DST-safe datetimes for Python
#44A tangent, but I hope the world gets its shit together and gets rid of DST. I am currently enjoying DST-free life in Japan, and feel that people around the world deserve to get this much respect from their own official clocks.
And for program code, it wouldn’t really help as long as it’s still expected to be able to correctly handle dates in the past.
Re: Whenever: Typed and DST-safe datetimes for Python
#45Earlier quoted context omitted.
Creating from scratch also creates hidden debt, it's just moved onto yourself. Especially when working with dates and timezones.
A library that goes "poof" when you need to upgrade it is also a hidden debt
Re: Whenever: Typed and DST-safe datetimes for Python
#46Am I the only one to stick with the std lib, read the docs and changelogs carefully, and implement functions I really need the way my application makes use of them? I learned the hard way, that dependencies kill projects. Not saying this isn't great, thanks for creating it! It does have its use cases, of course.
Re: Whenever: Typed and DST-safe datetimes for Python
#47Earlier quoted context omitted.
> Am I the only one to stick with the std lib, read the docs and changelogs carefully I work in healthcare. If I have a choice between "reading docs/changelogs carefully, implementing functions", and "adding an extra dependency", I'm taking the dependency every single time. I don't want footguns in my code, I don't want code I have to write and test myself, and I don't want to have to become an expert in a domain bef…
My hope is that a lib like this one or similar could rally mindshare and become integrated as the new standard, and adopted by the wider developer community. In near term, it comes down to trade-offs. I see no decision that works for all use cases. Dependencies introduce ticking time bombs, stdlibs should be correct and intuitive, but at least when not they are usually well tested and maintained, but when stdlib don'…
Re: Whenever: Typed and DST-safe datetimes for Python
#48Earlier quoted context omitted.
So your projects end up with their own "lib" of scattered time functions, possibly with new small bugs. I'd then rather have a proper well-tested and maintained library.
The "lib" one needs for date time functions is as good as non-existent. But yeah, you will have to create tests for the codepath, instead of relying on the tests the library maintainers create.
Given how many tests I see fail on 29th February at the companies I’ve been at, I don’t trust my colleagues’ tests either!
Re: Whenever: Typed and DST-safe datetimes for Python
#49Ah nice it solves the Liskov violation that the standard library has. In the standard library, dates can be compared with I wonder what benefits this choice has that outweigh the risks of this behavior.
What would you do about equality comparisons?
Re: Whenever: Typed and DST-safe datetimes for Python
#50Earlier quoted context omitted.
Creating from scratch also creates hidden debt, it's just moved onto yourself. Especially when working with dates and timezones.
A library that goes "poof" when you need to upgrade it is also a hidden debt
Timedates are hard, and units may require even harder historical/present "political" tracking as how they are defined, and I would never want to maintain this kind of dependency: https://github.com/ryantenney/gnu-units/blob/master/units.da...
And what comes to timedate problems, I try to keep it simple if the project allows: store and operate with UTC timestamps everywhere and only temporarily convert to to local time (DSTs applied, if such) when displaying it in user-facing UI. This functionality/understanding can be locked into own 20-line microlibrary-dependency, which forces its responsible person to understand country's timezone and when e.g. DST changes and where/how/who decides DST changes and what APIs is used to get UTC time (and of course, its dependencies, e.g. NTP, and its dependencies. e.g. unperturbed ground-state hyperfine transition frequency of the caesium-133 atom, which result is then combined with the Pope Gregory XIII's Gregorian calendar, which is a type of solar calendar mixed with religious event for fixing the time, which which is then finally corrected by rewinding/forwarding "the clock" because its too bright or dark for the politicians).