 		  ;; no comment, so go back
 		  (goto-char start))))))))
 
-(defun py-comment-region (start end &optional uncomment-p)
-  "Comment out region of code; with prefix arg, uncomment region.
-The lines from the line containing the start of the current region up
-to (but not including) the line containing the end of the region are
-commented out, by inserting the string `py-block-comment-prefix' at
-the start of each line.  With a prefix arg, removes
-`py-block-comment-prefix' from the start of each line instead."
-  (interactive "*r\nP")   ; region; raw prefix arg
-  (goto-char end)   (beginning-of-line) (setq end (point))
-  (goto-char start) (beginning-of-line) (setq start (point))
-  (let ((prefix-len (length py-block-comment-prefix)) )
-    (save-excursion
-      (save-restriction
-	(narrow-to-region start end)
-	(while (not (eobp))
-	  (if uncomment-p
-	      (and (string= py-block-comment-prefix
-			    (buffer-substring
-			     (point) (+ (point) prefix-len)))
-		   (delete-char prefix-len))
-	    (insert py-block-comment-prefix))
-	  (forward-line 1))))))
+;; ripped from cc-mode
+(defun py-forward-into-nomenclature (&optional arg)
+  "Move forward to end of a nomenclature section or word.
+With arg, to it arg times.
+
+A `nomenclature' is a fancy way of saying AWordWithMixedCaseNotUnderscores."
+  (interactive "p")
+  (let ((case-fold-search nil))
+    (if (> arg 0)
+	(re-search-forward
+	 "\\(\\W\\|[_]\\)*\\([A-Z]*[a-z0-9]*\\)"
+	 (point-max) t arg)
+      (while (and (< arg 0)
+		  (re-search-backward
+		   "\\(\\W\\|[a-z0-9]\\)[A-Z]+\\|\\(\\W\\|[_]\\)\\w+"
+		   (point-min) 0))
+	(forward-char 1)
+	(setq arg (1+ arg)))))
+  (py-keep-region-active))
+
+(defun py-backward-into-nomenclature (&optional arg)
+  "Move backward to beginning of a nomenclature section or word.
+With optional ARG, move that many times.  If ARG is negative, move
+forward.
+
+A `nomenclature' is a fancy way of saying AWordWithMixedCaseNotUnderscores."
+  (interactive "p")
+  (py-forward-into-nomenclature (- arg))
+  (py-keep-region-active))
+
 
  

preceding line's indentation.  When this flag is nil, continuation
lines are aligned to column zero.")

(defvar py-block-comment-prefix "##"
  "*String used by `py-comment-region' to comment out a block of code.
This should follow the convention for non-indenting comment lines so
that the indentation commands won't get confused (i.e., the string
should be of the form `#x...' where `x' is not a blank or a tab, and
`...' is arbitrary).")

(defvar py-scroll-process-buffer t
  "*Scroll Python process buffer as output arrives.

       ((py-continuation-line-p)
	(let ((startpos (point))
	      (open-bracket-pos (py-nesting-level))
	      endpos searching found state)
	  (if open-bracket-pos
	      (progn
		;; align with first item in list; else a normal
