More Information on P Traps:
The 'P' trap - normally with a twist joint half way along so that the trap is easily removed without disturbing the pipework if it's required to remove a blockage. The socket can be corrected through something like 270° from the horizontal plane to accommodate the position of the flat waste pipe attached to it. A drawback of the 'P' trap is that it needs a reasonable amount of space around the waste outlet.
The dimensions quoted are the inner pipe dimensions (and also the waste outlet in the sink/basin/bath etc), the outer diameter of the pipework does change between different manufacturers thus pipes and fitting might not be interchangeable. One of the most important facets of waste water traps is the thickness of seal. Typically the waste pipe fits to the trap with a twist coupling (using a compression seal ring) or a push fit'O' ring coupling - there isn't much to select between the two types.
A trap of any sort is utterly useless by itself, its not until it has water in it that it becomes useful. The water sits at the U bend where it creates a congestion for gas trying to get back in the room. If it manages to get back up a pipe it could, were it not averted, get back into the room from where it arrived! As you might imagine a good deal of toilet and bathroom waste contributes to a great build up of foul gas and the gas tries to escape back up the pipes or through another aperture it could get through.