Stream: helpdesk (published)

Topic: get nth pair from `OrderedDict`


view this post on Zulip Expanding Man (Feb 14 2021 at 18:36):

Is there a method to get pair n from an ordered dict? (Other than doing dct.keys[n]=>dct.vals[n], which does not seem blessed by the API)

view this post on Zulip Mason Protter (Feb 14 2021 at 19:08):

I think from the ordered nature of the dict, that has to be okay, right?

view this post on Zulip Mason Protter (Feb 14 2021 at 19:09):

I guess the slightly more blessed interface would be

keys(dct)[n] => values(dct)[n]

view this post on Zulip Expanding Man (Feb 14 2021 at 19:10):

yeah, fair enough, I guess it was a stupid question


Last updated: Nov 22 2024 at 04:41 UTC