Although there are exceptions, in the realm of pistols one can learn to recognize most double-action and single-action pistols in the general sense. Some have more than one mode or may be double-action only or variations are available for some make and models. Learning to operate and shoot them all would be a tall order for anyone. If the pistol is unfamiliar and the goal is simply to clear, a starting point would be;
With muzzle maintained in a safe direction/finger maintained away from trigger, find the magazine release and drop the magazine.
Pull back the slide to eject / check chamber. If the slide will not draw back, it is probably a mechanical safety locking it which can be located and released.
Some revolvers may provide a bit of a puzzle to open. In fact although most revolvers are single, single and double, or DAO - there have probably been a great variety of ways revolver cylinders are "unlocked".
If you find yourself picking up a pistol or revolver impromptu during a fight let's face it; if you do not immediately recognize it you may of may not have a chance to look at it closer before using it. Even if you think you recognize it, it may be a variant. Some companies are making the same pistols available with different trigger modes. So although they might have different controls, it may not be immediately apparent which one you have in your hand.
If the need to fire is immediate I would suggest just to aim and pull the trigger. If nothing happens one is left to methodically run through a process of elimination - as quickly as possible.
If you are pretty sure it is primarily a DA/SA or SA pistol then you know the hammer must be cocked unless it is DAO - in which case there is usually no useable hammer spur. Nearly all frame mounted safeties are thumb "down" to fire; an exception would be the Browning BDM which is "up" to fire - "down" acts as a decocker IIRC unless it is set in DAO mode.
Slide mounted safeties can be "safe" or "fire" in the "up" or "down" - or "back" and "forth" position as one might view some of them. If you are not sure of any particular model it is going to a case of attempting to fire, and if necessary moving the safety to "the other position" - whatever that "other position" happens to be - and try to fire again.
Then there are the single shots (antique and modern), the derringer-types and the various (mostly antigue) gadget guns.
Then there are rifles ... and shotguns.