* lisp/progmodes/python.el (python-base-mode): Use heuristic to better
support the Python walrus operator := in electric-layout-rules.
(cherry picked from commit
ee6e737fdf7a1bea3abec383a1bf0ae69ac8ca77)
`((?: . ,(lambda ()
(and (zerop (car (syntax-ppss)))
(python-info-statement-starts-block-p)
+ ;; Heuristic: assume walrus operator :=
+ ;; when colon is preceded by space.
+ (save-excursion
+ (goto-char (- (point) 2))
+ (looking-at (rx (not space) ":")))
'after)))))
;; Add """ ... """ pairing to electric-pair-mode.