Well, looks like this proposal is dead in the water. Thanks for your opinions everybody, I'll close the PR.
Also, for Alex and Richard, `path.parts` would do the trick. On Sun, May 24, 2020 at 2:55 PM Richard Damon <rich...@damon-family.org> wrote: > On 5/24/20 7:27 AM, Ram Rachum wrote: > > Hi everyone, > > > > I submitted a PR today, and Serhiy decided it needs a discussion on > > python-ideas and agreement from core developers before it could go > > forward. > > > > BPO: https://bugs.python.org/issue40752 > > PR: https://github.com/python/cpython/pull/20348 > > > > Today I wrote a script and did this: > > > > sorted(paths, key=lambda path: len(str(path)), reverse=True) > > > > But it would have been nicer if I could do this: > > > > sorted(paths, key=len, reverse=True) > > > > So I implemented `PurePath.__len__` as `str(len(path))`. > > > > Serhiy and Remi objected, because it might not be obvious that the > > length of the path would be the length of string. > > > > What do you think? Can I get some +1s and -1s for this change? > > > > > > Thanks, > > Ram. > > While the length of the string representation might be one definition of > length, so might the 'depth' (how many directory levels down does it > go), and that might be considered more fundamental, and thus a better > choice if anything was defined as its 'length' (which I am not sure it > should). > > Length (as you are using it) is really a sequence like property, and > paths are that much like a sequence. > > -- > Richard Damon > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/7ZQM3E6EZ4N456HYGWN65GGDV3HEIVPR/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/KSX5RGBO6UOPC3BLLPV2TGFSXSIVNSNJ/ Code of Conduct: http://python.org/psf/codeofconduct/