News for hackers. Stuff that matters.
Re:Whenever – typed and DST-safe datetimes for Python by globular-toast on Sunday April 13, 2025 @08:55AM (#43672453)
> 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 dependency does not relieve you of reading docs, but it also adds a further burden as you now need to trust the code. The stdlib is much more heavily tested and documented than any 3rd party library will be.

Re:Whenever – typed and DST-safe datetimes for Python by stavros on Sunday April 13, 2025 @09:02AM (#43672504)
> The stdlib is much more heavily tested and documented than any 3rd party library will be.

You initially said you write your own code instead of using libraries, I replied to that, and now it's that you use the stdlib instead of libraries. I won't argue against shifting goalposts.

Re:Whenever – typed and DST-safe datetimes for Python by filoeleven on Sunday April 13, 2025 @10:27AM (#43673050)
The poster who you just replied to is not the same person who started the thread. I am yet another person.

In addition, the original post begins with, "Am I the only one to stick with the std lib". The goalposts are stable.

Re:Whenever – typed and DST-safe datetimes for Python by stavros on Sunday April 13, 2025 @10:31AM (#43673085)
Again, the library in the article removes some stdlib footguns. The footguns are there, and if you use the stdlib, you need to remove (or avoid) them yourself. There's no free lunch, and you'll either need to remove them yourself (and test that code), avoid them (and constantly remember to not hit them), or use another library.

It's not a choice between "using a dependency" or "using something in the stdlib", where all other code remains the same, otherwise there would be no point to writing a library, as it would offer nothing over `datetime`.

Re:Whenever – typed and DST-safe datetimes for Python by ok_dad on Sunday April 13, 2025 @04:41PM (#43675684)
That’s why I’m a software developer though, because I learned the footguns in the standard library. I use it before third party libraries whenever I can. I can’t understand the fear, just learn your job.
Re:Whenever – typed and DST-safe datetimes for Python by stavros on Sunday April 13, 2025 @04:51PM (#43675767)
If your approach to footguns is "just learn your job", I'm sorry, but you aren't a very good software developer.
Re:Whenever – typed and DST-safe datetimes for Python by ok_dad on Tuesday April 15, 2025 @02:40PM (#43696824)
Well you know nothing about me so screw off.
Re:Whenever – typed and DST-safe datetimes for Python by stavros on Tuesday April 15, 2025 @02:46PM (#43696897)
You felt you knew enough about me to tell me to learn my job, so I figured you'd be open to similar feedback.
Re:Whenever – typed and DST-safe datetimes for Python by ok_dad on Tuesday April 15, 2025 @04:15PM (#43697847)
True, my bad. I apologize. I’m impressed by your grace with this comment.
Re:Whenever – typed and DST-safe datetimes for Python by mr_mitm on Sunday April 13, 2025 @08:57AM (#43672479)
> 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 additional barrier as well.

Re:Whenever – typed and DST-safe datetimes for Python by freehorse on Sunday April 13, 2025 @09:49AM (#43672789)
To be fair, comment^^ actually said

    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 by robertlagrant on Sunday April 13, 2025 @03:02PM (#43675047)
> If I use python I call pandas to read csvs

So it's you that isn't just using the built in csv parser in this project I inherited. Come back and repent.

Re:Whenever – typed and DST-safe datetimes for Python by akerl_ on Sunday April 13, 2025 @05:53PM (#43676137)
How could it possibly be true that libraries that are so commonly used that you consider them “the standard” are so infrequently used as to be a “very small minority” of libraries people actually use?
Re:Whenever – typed and DST-safe datetimes for Python by freehorse on Tuesday April 15, 2025 @04:10AM (#43690206)
I am not sure I understand the comment. I used pandas as an example of sth I frequently encounter when dealing with python code dealing with data frames. Is it not commonly used? What’s your argument here, I am genuinely asking.
Re:Whenever – typed and DST-safe datetimes for Python by akerl_ on Wednesday April 16, 2025 @09:04AM (#43704989)
I'm trying to square two aspects of your comment:

> Some libraries are so common that basically everybody uses them, to the point that they're considered the standard and they don't count when I raise complaints about people pulling in dependencies

> "But that's probably a very small minority of libraries that people actually use in certain languages."

It seems like by definition, the majority of libraries that people are actually using are going to be the popular ones that everybody is using.

Re:Whenever – typed and DST-safe datetimes for Python by oefrha on Sunday April 13, 2025 @12:34PM (#43673981)
The stdlib datetime module is in more of a sorry state than certain third party libraries and is full of footguns, as you, a read-the-docs-and-changelogs-carefully person, can surely tell from the myriad deprecations and warnings added over the years, not to mention the confusing params like tz and tzinfo. Heavily tested doesn’t mean shit when the semantics of the API is fundamentally flawed and can’t be updated.
Re:Whenever – typed and DST-safe datetimes for Python by paulddraper on Sunday April 13, 2025 @04:09PM (#43675478)
Did OP blindly install the package?

Or do it with sight?

Re:Whenever – typed and DST-safe datetimes for Python by crote on Sunday April 13, 2025 @04:33PM (#43675641)
> Taking on a dependency does not relieve you of reading docs, but it also adds a further burden as you now need to trust the code. The stdlib is much more heavily tested and documented than any 3rd party library will be.

Sure, but the opposite applies as well. Sticking with the flawed stdlib means you are trusting that every single future developer is as careful in reading all the docs as you are - even when it's someone reviewing that random trivial-looking patch which is secretly hiding a massive footgun. A junior developer submitted a five-line patch touching datetime? Better schedule several hours for a proper analysis!

Or you can write your own wrapper code, of course. Which will almost certainly have worse documentation and testing than a popular third-party library.

External libraries aren't evil. When chosen properly, they relieve you of burdens. You shouldn't grab any random "leftpad"-like dependency like they are going out of fashion, but something as complicated as timezone handling is best left to code written by domain experts - which means using a library.