if I select a single object through the UI then it becomes both selected and active
you are right, that is ONE user action but actually TWO things happen. But I take the view, that this kind of object selection isn’t an operator - there is no bpy.ops.object.select_by_click or similar, if it was, then it should act like a selection click of course.
should leave MyObject both selected and active […] select_pattern() does not behave as selection does in the UI
Hm, it would be nicer if select_pattern kept the object active (maybe report as bug, although it will likely be considered a feature request). But the behavior seems consistent between UI and API call?!
Each operator must document what it works on.
most operators should tell what they will do by their name, select_pattern does change selection as the name implies. So you get what you expect, a new/changed selection. The clearing of the active object in case of extend=False and the active object being matched by the pattern is sort of a side-effect, maybe worth mentioning but rather to be fixed in code.
Of course it would be nice to have all involved objects documented, but I worry API pages would get messy, as many ops use quite a lot objects. And these objects may change but the devs may forget to update API or API might simply stay incomplete (some ops explained in detail, others not). And if you really want to know what an operator does, well, I’d prefer to read the code myself - although I will never fully understand it, as I’m by far not a coder - and try to guess from var names (which seemed rather intuitive whenever i tried).
Anyway, if you say each op must be documented, get some help by someone who knows a bit C/Blender code and write docs - everyone would benefit!
Are you a Blender developer? Does this represent the general opinion of Blender developers?
No and maybe?
If each operator acted upon a random object, […] each operator chose […] each operator deterministically works upon either the selected object(s) or the active object, but which one is unknown, then the API is useless.
only the select_random operator implies that it will randomly chose objects. In all other cases, UI and API behavior appears to be consistent and you can easily see in viewport if the active object is treated differently from selected objects. But well, a hint in the docs if the active object takes a special role wouldn’t hurt.
In order to use the Python API one needs to read C?
would be enough to know that there is a selection state and an active object. You may always set an active object to be sure ops will work, even if they don’t care about the active “state”.