Merge branch 'document-python-options'

* document-python-options:
  Changes file update
  Python -newvwm command line option remains undocumented
  Document all the Python command line options
  Python command line options tidyup
  Remove redundant Python options: -nocastmode -nodirvtable -noextranative -nofastproxy
  Tidy up Python command line options help text
diff --git a/CHANGES.current b/CHANGES.current
index 0ae9287..9adecb8 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -184,7 +184,11 @@
               -newrepr
               -noaliasobj0
               -nobuildnone
+              -nocastmode
+              -nodirvtable
+              -noextranative
               -nofastinit
+              -nofastproxy
               -nofastquery
               -nomodern
               -nomodernargs
diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html
index 4919d2c..d9bc4bc 100644
--- a/Doc/Manual/Contents.html
+++ b/Doc/Manual/Contents.html
@@ -1592,7 +1592,8 @@
 <li><a href="Python.html#Python_nn9">Using your module</a>
 <li><a href="Python.html#Python_nn10">Compilation of C++ extensions</a>
 <li><a href="Python.html#Python_nn11">Compiling for 64-bit platforms</a>
-<li><a href="Python.html#Python_nn12">Building Python Extensions under Windows</a>
+<li><a href="Python.html#Python_nn12">Building Python extensions under Windows</a>
+<li><a href="Python.html#Python_commandline">Additional Python commandline options</a>
 </ul>
 <li><a href="Python.html#Python_nn13">A tour of basic C/C++ wrapping</a>
 <ul>
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
index d2b090b..6ec5725 100644
--- a/Doc/Manual/Python.html
+++ b/Doc/Manual/Python.html
@@ -21,7 +21,8 @@
 <li><a href="#Python_nn9">Using your module</a>
 <li><a href="#Python_nn10">Compilation of C++ extensions</a>
 <li><a href="#Python_nn11">Compiling for 64-bit platforms</a>
-<li><a href="#Python_nn12">Building Python Extensions under Windows</a>
+<li><a href="#Python_nn12">Building Python extensions under Windows</a>
+<li><a href="#Python_commandline">Additional Python commandline options</a>
 </ul>
 <li><a href="#Python_nn13">A tour of basic C/C++ wrapping</a>
 <ul>
@@ -798,7 +799,7 @@
 extension.
 </p>
 
-<H3><a name="Python_nn12">38.2.8 Building Python Extensions under Windows</a></H3>
+<H3><a name="Python_nn12">38.2.8 Building Python extensions under Windows</a></H3>
 
 
 <p>
@@ -810,6 +811,7 @@
 build</tt> should just work.
 </p>
 
+
 <p>
 As of python2.5, the distutils support building extensions with MingGW out
 of the box. Following the instruction here:
@@ -927,6 +929,50 @@
 </p>
 
 
+<H3><a name="Python_commandline">38.2.9 Additional Python commandline options</a></H3>
+
+
+<p>
+The following table lists the additional commandline options available for the Python module. They can also be seen by using:
+</p>
+
+<div class="code"><pre>
+swig -python -help
+</pre></div>
+
+<table summary="Python specific options">
+<tr>
+<th>Python specific options</th>
+</tr>
+
+<tr><td>-builtin        </td><td>Create Python built-in types rather than proxy classes, for better performance</td></tr>
+<tr><td>-castmode       </td><td>Enable the casting mode, which allows implicit cast between types in Python</td></tr>
+<tr><td>-debug-doxygen-parser     </td><td>Display doxygen parser module debugging information</td></tr>
+<tr><td>-debug-doxygen-translator </td><td>Display doxygen translator module debugging information</td></tr>
+<tr><td>-dirvtable      </td><td>Generate a pseudo virtual table for directors for faster dispatch</td></tr>
+<tr><td>-doxygen        </td><td>Convert C++ doxygen comments to pydoc comments in proxy classes</td></tr>
+<tr><td>-extranative    </td><td>Return extra native wrappers for C++ std containers wherever possible</td></tr>
+<tr><td>-fastproxy      </td><td>Use fast proxy mechanism for member methods</td></tr>
+<tr><td>-globals &lt;name&gt; </td><td>Set &lt;name&gt; used to access C global variable (default: 'cvar')</td></tr>
+<tr><td>-interface &lt;mod&gt;</td><td>Set low-level C/C++ module name to &lt;mod&gt; (default: module name prefixed by '_')</td></tr>
+<tr><td>-keyword        </td><td>Use keyword arguments</td></tr>
+<tr><td>-nofastunpack   </td><td>Use traditional UnpackTuple method to parse the argument functions</td></tr>
+<tr><td>-noh            </td><td>Don't generate the output header file</td></tr>
+<tr><td>-noproxy        </td><td>Don't generate proxy classes</td></tr>
+<tr><td>-nortti         </td><td>Disable the use of the native C++ RTTI with directors</td></tr>
+<tr><td>-nothreads      </td><td>Disable thread support for the entire interface</td></tr>
+<tr><td>-olddefs        </td><td>Keep the old method definitions when using -fastproxy</td></tr>
+<tr><td>-py3            </td><td>Generate code with Python 3 specific features and syntax</td></tr>
+<tr><td>-relativeimport </td><td>Use relative Python imports</td></tr>
+<tr><td>-threads        </td><td>Add thread support for all the interface</td></tr>
+<tr><td>-O              </td><td>Enable the following optimization options: -fastdispatch -fastproxy -fvirtual</td></tr>
+
+</table>
+
+<p>
+Many of these options are covered later on and their use should become clearer by the time you have finished reading this section on SWIG and Python.
+</p>
+
 <H2><a name="Python_nn13">38.3 A tour of basic C/C++ wrapping</a></H2>
 
 
diff --git a/Examples/test-suite/li_implicit.i b/Examples/test-suite/li_implicit.i
index 0ce10dd..9f3ea31 100644
--- a/Examples/test-suite/li_implicit.i
+++ b/Examples/test-suite/li_implicit.i
@@ -1,4 +1,7 @@
-%module("nocastmode") li_implicit
+%module li_implicit
+
+// Tests nocastmode
+
 #pragma SWIG nowarn=SWIGWARN_PP_CPP_WARNING
 %include implicit.i
 
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index 8b6e08a..a0f0494 100755
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -106,35 +106,29 @@
 
 static const char *usage1 = "\
 Python Options (available with -python)\n\
-     -builtin        - Create new python built-in types, rather than proxy classes, for better performance\n\
-     -castmode       - Enable the casting mode, which allows implicit cast between types in python\n\
-     -dirvtable      - Generate a pseudo virtual table for directors for faster dispatch \n\
-     -doxygen        - Convert C++ doxygen comments to pydoc comments in proxy classes \n\
+     -builtin        - Create Python built-in types rather than proxy classes, for better performance\n\
+     -castmode       - Enable the casting mode, which allows implicit cast between types in Python\n\
      -debug-doxygen-parser     - Display doxygen parser module debugging information\n\
      -debug-doxygen-translator - Display doxygen translator module debugging information\n\
-     -extranative    - Return extra native C++ wraps for std containers when possible \n\
-     -fastproxy      - Use fast proxy mechanism for member methods \n\
-     -globals <name> - Set <name> used to access C global variable [default: 'cvar']\n\
-     -interface <lib>- Set the lib name to <lib>\n\
+     -dirvtable      - Generate a pseudo virtual table for directors for faster dispatch\n\
+     -doxygen        - Convert C++ doxygen comments to pydoc comments in proxy classes\n\
+     -extranative    - Return extra native wrappers for C++ std containers wherever possible\n\
+     -fastproxy      - Use fast proxy mechanism for member methods\n\
+     -globals <name> - Set <name> used to access C global variable (default: 'cvar')\n\
+     -interface <mod>- Set low-level C/C++ module name to <mod> (default: module name prefixed by '_')\n\
      -keyword        - Use keyword arguments\n";
 static const char *usage2 = "\
-     -newvwm         - New value wrapper mode, use only when everything else fails \n\
-     -nocastmode     - Disable the casting mode (default)\n\
-     -nodirvtable    - Don't use the virtual table feature, resolve the python method each time (default)\n\
-     -noexcept       - No automatic exception handling\n\
-     -noextranative  - Don't use extra native C++ wraps for std containers when possible (default) \n\
-     -nofastunpack   - Use traditional UnpackTuple method to parse the argument functions (default) \n\
-     -nofastproxy    - Use traditional proxy mechanism for member methods (default) \n\
+     -nofastunpack   - Use traditional UnpackTuple method to parse the argument functions\n\
      -noh            - Don't generate the output header file\n";
 static const char *usage3 = "\
-     -noproxy        - Don't generate proxy classes \n\
+     -noproxy        - Don't generate proxy classes\n\
      -nortti         - Disable the use of the native C++ RTTI with directors\n\
      -nothreads      - Disable thread support for the entire interface\n\
      -olddefs        - Keep the old method definitions when using -fastproxy\n\
      -py3            - Generate code with Python 3 specific features and syntax\n\
-     -relativeimport - Use relative python imports \n\
+     -relativeimport - Use relative Python imports\n\
      -threads        - Add thread support for all the interface\n\
-     -O              - Enable the following optimization options: \n\
+     -O              - Enable the following optimization options:\n\
                          -fastdispatch -fastproxy -fvirtual\n\
 \n";
 
@@ -351,9 +345,6 @@
 	} else if (strcmp(argv[i], "-dirvtable") == 0) {
 	  dirvtable = 1;
 	  Swig_mark_arg(i);
-	} else if (strcmp(argv[i], "-nodirvtable") == 0) {
-	  dirvtable = 0;
-	  Swig_mark_arg(i);
 	} else if (strcmp(argv[i], "-doxygen") == 0) {
 	  doxygen = 1;
 	  scan_doxygen_comments = 1;
@@ -370,29 +361,21 @@
 	} else if (strcmp(argv[i], "-fastproxy") == 0) {
 	  fastproxy = 1;
 	  Swig_mark_arg(i);
-	} else if (strcmp(argv[i], "-nofastproxy") == 0) {
-	  fastproxy = 0;
-	  Swig_mark_arg(i);
 	} else if (strcmp(argv[i], "-olddefs") == 0) {
 	  olddefs = 1;
 	  Swig_mark_arg(i);
 	} else if (strcmp(argv[i], "-castmode") == 0) {
 	  castmode = 1;
 	  Swig_mark_arg(i);
-	} else if (strcmp(argv[i], "-nocastmode") == 0) {
-	  castmode = 0;
-	  Swig_mark_arg(i);
 	} else if (strcmp(argv[i], "-extranative") == 0) {
 	  extranative = 1;
 	  Swig_mark_arg(i);
-	} else if (strcmp(argv[i], "-noextranative") == 0) {
-	  extranative = 0;
-	  Swig_mark_arg(i);
 	} else if (strcmp(argv[i], "-noh") == 0) {
 	  no_header_file = 1;
 	  Swig_mark_arg(i);
 	} else if (strcmp(argv[i], "-newvwm") == 0) {
 	  /* Turn on new value wrapper mode */
+	  /* Undocumented option, did have -help text: New value wrapper mode, use only when everything else fails */
 	  Swig_value_wrapper_mode(1);
 	  no_header_file = 1;
 	  Swig_mark_arg(i);
@@ -435,8 +418,12 @@
 		   strcmp(argv[i], "-newrepr") == 0 ||
 		   strcmp(argv[i], "-noaliasobj0") == 0 ||
 		   strcmp(argv[i], "-nobuildnone") == 0 ||
+		   strcmp(argv[i], "-nocastmode") == 0 ||
 		   strcmp(argv[i], "-nocppcast") == 0 ||
+		   strcmp(argv[i], "-nodirvtable") == 0 ||
+		   strcmp(argv[i], "-noextranative") == 0 ||
 		   strcmp(argv[i], "-nofastinit") == 0 ||
+		   strcmp(argv[i], "-nofastproxy") == 0 ||
 		   strcmp(argv[i], "-nofastquery") == 0 ||
 		   strcmp(argv[i], "-nomodern") == 0 ||
 		   strcmp(argv[i], "-nomodernargs") == 0 ||
@@ -507,13 +494,15 @@
 	    castmode = 1;
 	  }
 	  if (Getattr(options, "nocastmode")) {
-	    castmode = 0;
+	    Printf(stderr, "Deprecated module option: %s. This option is no longer supported.\n", "nocastmode");
+	    SWIG_exit(EXIT_FAILURE);
 	  }
 	  if (Getattr(options, "extranative")) {
 	    extranative = 1;
 	  }
 	  if (Getattr(options, "noextranative")) {
-	    extranative = 0;
+	    Printf(stderr, "Deprecated module option: %s. This option is no longer supported.\n", "noextranative");
+	    SWIG_exit(EXIT_FAILURE);
 	  }
 	  if (Getattr(options, "outputtuple")) {
 	    Printf(stderr, "Deprecated module option: %s. This option is no longer supported.\n", "outputtuple");