operation.py: Refactor `polswitch' a little.