diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/typeobj.rst | 20 | ||||
-rw-r--r-- | Doc/tutorial/interpreter.rst | 6 | ||||
-rw-r--r-- | Doc/using/cmdline.rst | 8 |
3 files changed, 23 insertions, 11 deletions
diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst index b3433e1..f1a8233 100644 --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -649,13 +649,19 @@ The following three fields only exist if the .. cmember:: richcmpfunc PyTypeObject.tp_richcompare - An optional pointer to the rich comparison function. + An optional pointer to the rich comparison function, whose signature is + ``PyObject *tp_richcompare(PyObject *a, PyObject *b, int op)``. - The signature is the same as for :cfunc:`PyObject_RichCompare`. The function - should return the result of the comparison (usually ``Py_True`` or - ``Py_False``). If the comparison is undefined, it must return - ``Py_NotImplemented``, if another error occurred it must return ``NULL`` and set - an exception condition. + The function should return the result of the comparison (usually ``Py_True`` + or ``Py_False``). If the comparison is undefined, it must return + ``Py_NotImplemented``, if another error occurred it must return ``NULL`` and + set an exception condition. + + .. note:: + + If you want to implement a type for which only a limited set of + comparisons makes sense (e.g. ``==`` and ``!=``, but not ``<`` and + friends), directly raise :exc:`TypeError` in the rich comparison function. This field is inherited by subtypes together with :attr:`tp_compare` and :attr:`tp_hash`: a subtype inherits all three of :attr:`tp_compare`, @@ -681,10 +687,10 @@ The following three fields only exist if the | :const:`Py_GE` | ``>=`` | +----------------+------------+ + The next field only exists if the :const:`Py_TPFLAGS_HAVE_WEAKREFS` flag bit is set. - .. cmember:: long PyTypeObject.tp_weaklistoffset If the instances of this type are weakly referenceable, this field is greater diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst index 7b1730e..42fc6e1 100644 --- a/Doc/tutorial/interpreter.rst +++ b/Doc/tutorial/interpreter.rst @@ -169,6 +169,12 @@ The script can be given an executable mode, or permission, using the $ chmod +x myscript.py +On Windows systems, there is no notion of an "executable mode". The Python +installer automatically associates ``.py`` files with ``python.exe`` so that +a double-click on a Python file will run it as a script. The extension can +also be ``.pyw``, in that case, the console window that normally appears is +suppressed. + Source Code Encoding -------------------- diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index ba3e1c9..3dcfc7e 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -297,14 +297,14 @@ These environment variables influence Python's behavior. .. envvar:: PYTHONHOME Change the location of the standard Python libraries. By default, the - libraries are searched in :file:`{prefix}/lib/python<version>` and - :file:`{exec_prefix}/lib/python<version>`, where :file:`{prefix}` and + libraries are searched in :file:`{prefix}/lib/python{version}` and + :file:`{exec_prefix}/lib/python{version}`, where :file:`{prefix}` and :file:`{exec_prefix}` are installation-dependent directories, both defaulting to :file:`/usr/local`. When :envvar:`PYTHONHOME` is set to a single directory, its value replaces both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different values - for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}``. + for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`. .. envvar:: PYTHONPATH @@ -314,7 +314,7 @@ These environment variables influence Python's behavior. colons. Non-existent directories are silently ignored. The default search path is installation dependent, but generally begins with - :file:`{prefix}/lib/python<version>`` (see :envvar:`PYTHONHOME` above). It + :file:`{prefix}/lib/python{version}`` (see :envvar:`PYTHONHOME` above). It is *always* appended to :envvar:`PYTHONPATH`. If a script argument is given, the directory containing the script is |