Earlier quoted context omitted.
There are so many footguns in the datetime lib. That's why I use a Flake8 plugin to prohibit especially egregious footguns. https://github.com/jkittner/flake8-ban-utcnow
Honestly yeah who in tarnation created that function and called it utcnow These things are really frustrating
Whenever: Typed and DST-safe datetimes for Python
51–60 of 151 posts
Re: Whenever: Typed and DST-safe datetimes for Python
#52Am 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.
Creating from scratch also creates hidden debt, it's just moved onto yourself. Especially when working with dates and timezones.
The only crazier idea I can think of is implementing character encoding conversions myself.
Re: Whenever: Typed and DST-safe datetimes for Python
#53Am 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.
Curious about examples of projects being killed by dependencies.
You know, they import 5 libraries, each of which imports 5 more libraries, each of which imports 5 more libraries, and suddenly they're buried in 'critical' updates because there's a denial-of-service bug in the date parser used by the yaml parser used by the configuration library used by the logging library used by the application.
Re: Whenever: Typed and DST-safe datetimes for Python
#54Earlier quoted context omitted.
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 the list of issues (most of which I had never heard of) that the library author describes with datetime, I think I trust his tests over the ones I’d write. 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
#55Am 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.
You are a sad minority, IME. I’m right there with you. I extended the uuid library to generate UUIDv7, based off of the RFC. It’s pretty easy to implement, as it turns out. Overruled, because “we don’t want to have to maintain additional code.” As if the ABI for bitshifts is going to change?!
As long as there is a conscious decision to build or ‘buy’, it’s fine. I think some people can be a little too careless with adding dependencies though, not realising they can have an equal if not greater maintenance burden.
Re: Whenever: Typed and DST-safe datetimes for Python
#56Earlier 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
I would still rather using a library for dates, a million times so.
Re: Whenever: Typed and DST-safe datetimes for Python
#57Re: Whenever: Typed and DST-safe datetimes for Python
#58A 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.
I would wish for that as well, but it’s unlikely to happen. In the EU for example, some countries would be on the losing side, either by getting “bad” hours or by having to move to a different time zone than their neighbor, which has significant economic consequences. Such countries won’t agree to a DST abolishment that disadvantages them. And for program code, it wouldn’t really help as long as it’s still expected t…
Re: Whenever: Typed and DST-safe datetimes for Python
#59Earlier quoted context omitted.
Almost everyone wants to get rid of the twice annual clock changes but are nearly evenly divided on if DST should be permanent or cease to exist. It's a strange artifact of wanting clock noon to be the midpoint of the workday but also wanting to maximize the hours of daylight after work.
Who wants clock noon to be the midpoint of the workday? The canonical working hours are 9am to 5pm [Parton 1980] whose midpoint is at 1pm. Many people work earlier and/or later, but my impression is that it's pretty unusual to have the midpoint at noon. ( Schools tend to have earlier times. It's not so unusual for a school's workday to have its midpoint at about noon, I think.)
Re: Whenever: Typed and DST-safe datetimes for Python
#60Am 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.
Curious about examples of projects being killed by dependencies.
E.g the JS project that uses the stdlib Date API, and pulls in moment.js, and also uses date-fns.
Or the one that pulls in bits and pieces of lodash, ramda, and other functional libraries.
And maybe it uses native fetch and axios depending on the current phase of the moon.
They don’t die but time is wasted in code review trying to understand if there is any kind of deliberate approach behind the scattershot application of packages with duplicated purposes.
(picking on JS is perhaps unfair but it’s probably the most egregious example of dependency hell)