this post was submitted on 29 Jun 2023
13 points (100.0% liked)

Python

6339 readers
3 users here now

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

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

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

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago (1 children)

I'm increasingly convinced that Python/JS-style duck typing is always a mistake, since you can't do default function impls for traits. Just use inheritance.

Rust's enums are even weirder, since they mix structuring with discrimination. You end up having to write everything twice most of the time. Again, use inheritance, though you'll have to choose between if chains and virtual function calls.

Python's pathlib has a major footgun in that ./foo collapses to foo, negating the main point of writing it that way in the first place.

[–] [email protected] 1 points 1 year ago

More obnoxiously than that even, imo, it’s that pathlib removes trailing slashes. Its impossible (afaict) to reproduce path.join(‘a’, ‘b/‘) with pathlib