I'm somewhat confused by the term "last item of the set", as sets are not
ordered and have no "last" element:
>>> {1,3,3,2}
{1, 2, 3}
On Sat, Oct 2, 2021 at 8:23 PM Abdulla Al Kathiri <
[email protected]> wrote:
> Then use it with the normal expression lambda:
> people.sort(key=p => (p.salary, p.name, p.id)).
> You don’t need lambda set for that. If you want to use it, it will be like
> the following:
> people.sort(key=p => {(p.salary, p.name, p.id)}). The tuple expression is
> the last item of the set, so the tuple is the return value.
> Abdulla
>
> Sent from my iPhone
>
> > On 3 Oct 2021, at 2:25 AM, Chris Angelico <[email protected]> wrote:
> >
> > people.sort(key=lambda p: (p.salary, p.name, p.id))
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/YJKNUXZD6JJONZT6YY23OAFBB5QVWCA2/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/HG2IOSFVLDTL2YW4C234FCOENLW675JP/
Code of Conduct: http://python.org/psf/codeofconduct/