Antony Lee <anntzer....@gmail.com> added the comment:
A problem of having this bit of state in paths is that it violates assumptions based on immutability/hashability, e.g. with from pathlib import Path p = Path("foo") q = Path("foo") with p: pass unique_paths = {p, q} print(len(unique_paths)) # == 1, as p == q for path in unique_paths: print(path.resolve()) # Fails if the path is closed. The last line fails with `unique_paths = {p, q}` as p has been closed (and apparently sets keep the first element when multiple "equal" elements are passed in), but not with `unique_paths = {q, p}`. It would also prevent optimizations based on immutability as proposed in https://bugs.python.org/issue39783. ---------- nosy: +Antony.Lee _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39682> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com