[issue31269] bug in islink() and is_symlink()

Karine report at bugs.python.org
Fri Aug 25 02:39:09 EDT 2017


Karine added the comment:

Thanks a lot David

>Четверг, 24 августа 2017, 18:42 +04:00 от "R. David Murray" <report at bugs.python.org>:
>
>
>R. David Murray added the comment:
>
>I would phrase that as "check if any of the components of the path are links", at which point one "obvious"[*] answer is "any(x.is_symlink() for x in [*mypath.parents, mypath])".  If the path is absolute, you could use "not (mypath.resolve() == mypath)".
>
>[*] I put that in quotes because it is only obvious once you have a non-trivial amount of experience with programming in Python.
>
>----------
>
>_______________________________________
>Python tracker < report at bugs.python.org >
>< http://bugs.python.org/issue31269 >
>_______________________________________

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31269>
_______________________________________


More information about the Python-bugs-list mailing list