Accessing selection

Hi - I’m writing an auto renaming script that would change “###” sequence into digits but I’ve faced a problem. When I’m trying to access the Blender selection via context.selected_objects the array I’m getting back is not sorted according to the sequence in which I’ve selected those objects. Is there any way to get this sequence properly?