65
submitted 10 months ago by marsokod@lemmy.world to c/python@programming.dev
top 13 comments
sorted by: hot top controversial new old
[-] AlexWIWA@lemmy.ml 23 points 10 months ago

Would have been nice if they had just fixed it instead. Now I have to type more characters

[-] takeda@lemmy.world 15 points 10 months ago

Yeah, the names imply that those should be TZ aware. Though I can understand the reasoning, as this change can silently break already broken code that kind of works, and would be a nightmare to fix in a large codebase.

I also disagree with author, about naive datetime. I don't think there is a good use case for them, and people who use them, do so because they are not aware of the issues.

The only argument I saw was for micro performance improvements, which is kind of funny to care about when programming in python. Since it is implemented in C, the code removing the timezone likely takes more resources.

[-] jim@programming.dev 7 points 10 months ago

While it would be ideal to have all datetime fields in databases and other data stores be time zone aware, that is certainly not the case. Also, SQLite (and probably others) do not have great support for time zones and it's recommended to store datetimes as UTC (typically unix timestamps).

Deprecating utcnow was a good idea, but they should have replaced it with naive_utcnow. Oh well.

[-] BeardedGingerWonder@feddit.uk 9 points 10 months ago

Timezones are a disease and should be eradicated. I will die on this hill.

[-] sugar_in_your_tea@sh.itjust.works 8 points 10 months ago

Agreed. I'm an American and wish we could just all be on UTC. Yeah, my workday would start at like 0200, but that's a sacrifice I'm willing to make.

[-] Sigmatics@lemmy.ca 1 points 10 months ago

Everyone on UTC sounds like such a great idea that would solve so many problems.

Unfortunately humans are so dependent on daylight and the day night cycle that it will never work

[-] twoframesperminute@mastodon.social 4 points 10 months ago

@Sigmatics you can have everyone on the same time zone and still have different day/night cycles. It just means you have to get up at 14:00 and go to sleep at 5:00. The big problem with this is that the date-switch happens for everyone at the same time, which means you might have breakfast on Thursday and lunch on Friday. That makes it terribly inconvenient, and therefore probably unviable.

[-] Sigmatics@lemmy.ca -1 points 10 months ago

Yeah that's kind of what I meant. People like their days to start at the same time every day. We are creatures of habit.

[-] twoframesperminute@mastodon.social 1 points 10 months ago

@Sigmatics Habits can be unlearned over a few generations. Doesn't mean in becomes practical all if a sudden. It's just messy to say "I'll do this tomorrow" when "tomorrow" might mean "before I go to bed".

"See you Monday!"
"Eh, before or after sleep on Monday?"

It's just not viable. It requires us to think differently about what a date is, returning the original issue: different people living at different dates.

[-] AlexWIWA@lemmy.ml 3 points 10 months ago

I agree. I hate timezones so much

[-] twoframesperminute@mastodon.social -4 points 10 months ago

@BeardedGingerWonder will you adapt your time to be 7 hours later?

Thought so.

[-] BeardedGingerWonder@feddit.uk 2 points 10 months ago

You thought what?

[-] AlexWIWA@lemmy.ml 6 points 10 months ago

I agree.

The only use I can see for naive date times is you just read the date out of an old sql database, but it shouldn't leave the function naive, it should be converted first.

Python's timezone handling is probably my only complaint about the language. I shouldn't need to use libraries just to have timezones.

this post was submitted on 18 Nov 2023
65 points (98.5% liked)

Python

6145 readers
4 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

October 2023

November 2023

PastJuly 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS