On Mon, Oct 11, 2021 at 8:08 PM Steven D'Aprano <steve@pearwood.info> wrote:
I assume you're not just extracting the first value for the LOLs, you
must have some reason for it. It is *that reason* which counts as a
use-case.

I dug through our application code base (500k lines) and found just one use case of the first/last pattern, so my opinion is that it's quite rare.  This case is building the GUI labels for an undo list, and specializes the text of the label when the dict is exactly one long.  Looks something like this:

# 'undos' is a dict of attribute name:value pairs
if len(undos) == 1:
    undo_label = 'Set %s to %s' % list(undos.items())[0]
else:
    undo_label = 'Modify blah blah blah'
    ...

# Use 'undos' to do the database mods and so on...