Perhaps this behavior exists because there can also be a situation like this:
def test():
print("test")
[cursor, on empty line in middle of indented block]
where what electric indent does after pressing RET (creates new line aligned to the print statements) makes sense. I think it is mostly irritating though, and editors I tested, Vim and Sublime Text, do not automatically indent in any of the situations I mentioned.
FWIW this works as a workaround for me:
(setq electric-indent-functions
'((lambda (inserted-char)
(when (eq major-mode 'python-mode)
;; Do not auto-indent after inserting any empty line
(when (save-excursion
(previous-line)
(beginning-of-line)
(looking-at "^\s*$"))
'no-indent)))))
Cheers,
Jarek