2 ms·
Filenames need to be treated as binary because of bad designs decades ago. Rust handles this correctly imho, by having a separate type for such strings, OsStr.
by adrianN 7y ago
Filenames need to be treated as binary because of bad designs decades ago. Rust handles this correctly imho, by having a separate type for such strings, OsStr.
- takeda 7y agoRust had the luxury to learn from mistakes of others :) When python was created the Unicode didn't even exist. Anyway in python 3, many os functions accept string and bytes, and might behave depending on it. For example os.walk, if you pass path as byte string, will output paths as bytes.
- int_19h 7y agoPython has pathlib nowadays. But I'm not sure whether that stores them as raw bytes or Unicode internally - the API provides for either.