One way of controlling the cycling with TAB is to customize python-indent-trigger-commands
.
The docstring of the variable states
Commands that might trigger a `python-indent-line' call.
However it is not clear from the docstring that the variable can be
used to control cycling (actually I am not even sure if setting this
variable if the correct way of controlling indentation cycling). The
docstring of python-indent-line
explains the purpose of this variable better
When the variable last-command' is equal to one of the symbols inside python-indent-trigger-commands or FORCE-TOGGLE is non-nil it cycles levels indicated in the variable python-indent-levels by setting the current level in the variable `python-indent-current-level'.
So (setq python-indent-trigger-commands nil)
(or you can just remove indent-for-tab-command
from the list) can be used for disabling indentation cycling. There is
a slight disadvantage of this approach that you cannot use TAB indent code like the following where else
can either close for
or if
.
for ..:
if ..:
...
break
else:
...
You will have hit backspace before else
to reindent it such that it
closes the for
(by default it will be indented such that it closes the if
)