I'm just going to let fly with the +1s and -1s, don't take them too seriously, they're basically impressionistic (I'm not a huge user of pathlib yet).
Todd writes: > So although the names are tentative, perhaps there could be a "fullsuffix" > property to return the extensions as a single string, -0 '.'.join(p.suffixes) vs. p.fullsuffix? TOOWTDI says no. I also don't really see the use case. > a "nosuffix" extension to return the path without any extensions, +1 (subject to name bikeshedding) .suffixes itself is kinda useless without this, and you shouldn't have to roll your own Do you propose to return a Path or a str here? > and a "with_suffixes" method that replaces all the suffix and can > accept multiple arguments (which would then be joined to create the > extensions). Do you propose to return a Path or a str here? +1 for a Path, +0 for a str. > Second, for methods like "rename" and "replace", it would be nice if there > was an "exist_ok" argument that defaults to "True" to allow for safe > renaming. -1 I don't see how this is an improvement. If it would raise if exist_ok == False, then try: p.rename(another_p, exist_ok=False) except ExistNotOKError: take_evasive_action(p) doesn't seem like a big improvement over if p.exists(): take_evasive_action(p) else: p.rename(another_p) And if it doesn't raise, then the action just silently fails? Name bikeshedding: IIRC, if an argument is essentially always going to be one of a small number of literals, Guido strongly prefers a new method (eg, rename_safely). I will admit that the current API seems strange to me: on Unix, .rename and .replace are apparently the same, and both unsafe? I would prefer .rename Unix semantics (deprecated) .rename_safely replacement for .rename, raises if exists .replace silently replace Names to be bikeshedded per usual. > Third, it would be nice if there was a "uid" and "gid" method for getting > the numeric user and group IDs for a file, +1 > or alternatively a "numeric" argument for the "owner" and "group" > methods. -1 (see "Guido prefers" above) > Fourth, for the "is_*" methods, it would be nice if there was a "strict" > argument that would raise an exception if the file or directory doesn't > exist. -1 That seems weird in a library intended for the syntactic manipulation of uninterpreted paths (even though this is a semantic operation). TOOWTDI and EIBTI, as well. For backward compatibility, strict would have to default to False. > the example for the "parts" property should probably show at least > one file with an extension, +1 Steve _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/