“index” returns a list of tuples corresponding to the object name and index of the atoms in the selection.
cmd.index | commands