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.
More obnoxiously than that even, imo, it’s that pathlib removes trailing slashes. Its impossible (afaict) to reproduce path.join(‘a’, ‘b/‘) with pathlib
Your not suppose to worry about path segment separators as they are platform dependent. Use the library functions. So anywhere you hard code “/” is kind of questionable.
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
ifchains and virtual function calls.Python’s
pathlibhas a major footgun in that./foocollapses tofoo, negating the main point of writing it that way in the first place.More obnoxiously than that even, imo, it’s that pathlib removes trailing slashes. Its impossible (afaict) to reproduce
path.join(‘a’, ‘b/‘)with pathlibYour not suppose to worry about path segment separators as they are platform dependent. Use the library functions. So anywhere you hard code “/” is kind of questionable.