I was taught to do the same thing when I flew something small, pointy and fast.
However, on "modern" airliner-type transponders there is no need because one changes the squawk by pressing the Clear button, then simply pressing the four buttons corresponding to the given squawk.
I guess one
could accidentally press 77 or 76 or 75, but that would be silly, given that one is sitting in a comfortable seat in shirtsleeves, not pulling "g" and fumbling with a gloved finger in a dark part of the cockpit.
edited to add: I agree with
calypso.