W6 Hammersmith: why this London postcode has the number 6

Hammersmith is W6 because of the alphabet. W2 is Paddington, a district office, and in the Post Office's list of March 1917 the offices after it follow by name: Hammersmith comes after Ealing (W5) and before Hanwell (W7).
See W6 on the map