Actually, now that I think of it, there’s no reason you need to join the 2 names into a single str
. You could just leave it as a tuple
of last, first and Python will know what to do in comparing them.
>>> sorted(student_ids, key = lambda i: ((rec := student_recs[i])['last'], rec['first']))
[632453, 1261456, 532153]
So the lambda would be returning ('Potter', 'Harry')
rather than 'Potter, Harry'
. But whatever. The :=
part is still the same.
Fair, though I guess my interpretation was that
void*
is kind of like a black hole in that anything can fall into it in an unsettling way that loses information about what it was?