Sujet : Re: pathlib.Path.is_file vs os.path.isfile difference
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram) (ram@zedat.fu-berlin.de (Stefan Ram))
Groupes : comp.lang.pythonDate : 08. Mar 2024, 19:19:04
Autres entêtes
Organisation : Stefan Ram
Message-ID : <pathlibg-20240308191110@ram.dialup.fu-berlin.de>
References : 1
Albert-Jan Roskam <
sjeik_appie@hotmail.com> wrote or quoted:
Path(256 * "x").is_file() # OSError
os.path.isfile(256 * "x") # bool
Is this intended?
When something is documented and behaves accordingly,
we assume it was intended.
Does pathlib try to resemble os.path as closely as possible?
No.
The definition of "isfile" contains:
|except (OSError, ValueError):
| return False