Re: on sorting things

2020-01-29 Thread Cameron Simpson
On 20Dec2019 08:23, Chris Angelico wrote: On Fri, Dec 20, 2019 at 8:06 AM Eli the Bearded <*@eli.users.panix.com> wrote: Consider a sort that first compares file size and if the same number of bytes, then compares file checksum. Any decently scaled real world implementation would memoize the c

Re: on sorting things

2020-01-29 Thread Peter Otten
Tony Flury via Python-list wrote: > > On 20/12/2019 18:59, Peter Otten wrote: >> Chris Angelico wrote: >> >>> On Sat, Dec 21, 2019 at 5:03 AM Peter Otten <__pete...@web.de> wrote: PS: If you are sorting files by size and checksum as part of a deduplication effort consider using dict-s i

Re: on sorting things

2020-01-28 Thread Tony Flury via Python-list
On 20/12/2019 18:59, Peter Otten wrote: Chris Angelico wrote: On Sat, Dec 21, 2019 at 5:03 AM Peter Otten <__pete...@web.de> wrote: PS: If you are sorting files by size and checksum as part of a deduplication effort consider using dict-s instead: Yeah, I'd agree if that's the purpose. But l

Re: on sorting things

2019-12-20 Thread Chris Angelico
On Sat, Dec 21, 2019 at 6:01 AM Peter Otten <__pete...@web.de> wrote: > > Chris Angelico wrote: > > > On Sat, Dec 21, 2019 at 5:03 AM Peter Otten <__pete...@web.de> wrote: > >> PS: If you are sorting files by size and checksum as part of a > >> deduplication effort consider using dict-s instead: >

Re: on sorting things

2019-12-20 Thread Peter Otten
Chris Angelico wrote: > On Sat, Dec 21, 2019 at 5:03 AM Peter Otten <__pete...@web.de> wrote: >> PS: If you are sorting files by size and checksum as part of a >> deduplication effort consider using dict-s instead: > > Yeah, I'd agree if that's the purpose. But let's say the point is to > have a

Re: on sorting things

2019-12-20 Thread Chris Angelico
On Sat, Dec 21, 2019 at 5:03 AM Peter Otten <__pete...@web.de> wrote: > PS: If you are sorting files by size and checksum as part of a deduplication > effort consider using dict-s instead: Yeah, I'd agree if that's the purpose. But let's say the point is to have a guaranteed-stable ordering of fil

Re: on sorting things

2019-12-20 Thread Peter Otten
Eli the Bearded wrote: > In comp.lang.python, Peter Otten <__pete...@web.de> wrote: >> Eli the Bearded wrote: >>> But what caught my eye most, as someone relatively new to Python but >>> with long experience in C in Perl, is sorting doesn't take a > > s/C in /C and/ > > Ugh. > >>> *comparison*

Re: on sorting things

2019-12-19 Thread Chris Angelico
On Fri, Dec 20, 2019 at 8:06 AM Eli the Bearded <*@eli.users.panix.com> wrote: > > In comp.lang.python, Peter Otten <__pete...@web.de> wrote: > > Eli the Bearded wrote: > >> But what caught my eye most, as someone relatively new to Python but > >> with long experience in C in Perl, is sorting does

Re: on sorting things

2019-12-19 Thread Eli the Bearded
In comp.lang.python, Peter Otten <__pete...@web.de> wrote: > Eli the Bearded wrote: >> But what caught my eye most, as someone relatively new to Python but >> with long experience in C in Perl, is sorting doesn't take a s/C in /C and/ Ugh. >> *comparison* function, it takes a *key generator* fu

Re: on sorting things

2019-12-19 Thread Peter Otten
Eli the Bearded wrote: > I recently saw a link to an old post on a blog and then started looking > at the newer posts. This one: > > https://leancrew.com/all-this/2019/11/the-key-to-sorting-in-python/ > > discusses ways to deal with useful sorting of movie / television show > titles. Some initia

Re: on sorting things

2019-12-19 Thread Chris Angelico
On Thu, Dec 19, 2019 at 6:36 PM Eli the Bearded <*@eli.users.panix.com> wrote: > > I recently saw a link to an old post on a blog and then started looking > at the newer posts. This one: > > https://leancrew.com/all-this/2019/11/the-key-to-sorting-in-python/ > > discusses ways to deal with useful s

Re: on sorting things

2019-12-18 Thread Oscar Benjamin
On Thu, 19 Dec 2019 at 07:37, Eli the Bearded <*@eli.users.panix.com> wrote: > ... > But what caught my eye most, as someone relatively new to Python but > with long experience in C in Perl, is sorting doesn't take a > *comparison* function, it takes a *key generator* function, and that > function

on sorting things

2019-12-18 Thread Eli the Bearded
I recently saw a link to an old post on a blog and then started looking at the newer posts. This one: https://leancrew.com/all-this/2019/11/the-key-to-sorting-in-python/ discusses ways to deal with useful sorting of movie / television show titles. Some initial words should be re-ordered for sorti