I have been using Emacs to write Python 2 code. Now I have both Python 2.6 and 3.0 installed on my system, and I need to write Python 3 code as well.
Here is how the
The answer is yes. If you can distinguish Python 2 from Python 3, then it is a Simple Matter Of Programming to get emacs to do what you want.
(define run-python (&optional buffer)
(with-current-buffer (or buffer (current-buffer))
(if (is-python3-p)
(run-python3)
(run-python2))))
(define-key python-mode-map (kbd "C-c C-c") #'run-python)
All that's left to do is implement is-python3-p and run-python3 (etc.)