diff --git a/Doc/conf.py b/Doc/conf.py index de944ac884c..551452babd4 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -141,6 +141,8 @@ latex_preamble = r''' \strong{Python Software Foundation}\\ Email: \email{docs@python.org} } +\let\Verbatim=\OriginalVerbatim +\let\endVerbatim=\endOriginalVerbatim ''' # Documents to append as an appendix to all manuals. diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index a531350874a..94bcb1b1aba 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1202,20 +1202,22 @@ Basic customization object: dictionary builtin: hash - Called for the key object for dictionary operations, and by the built-in - function :func:`hash`. Should return an integer usable as a hash value - for dictionary operations. The only required property is that objects which - compare equal have the same hash value; it is advised to somehow mix together - (e.g., using exclusive or) the hash values for the components of the object that - also play a part in comparison of objects. + Called by built-in function :func:`hash` and for operations on members of + hashed collections including :class:`set`, :class:`frozenset`, and + :class:`dict`. :meth:`__hash__` should return an integer. The only required + property is that objects which compare equal have the same hash value; it is + advised to somehow mix together (e.g. using exclusive or) the hash values for + the components of the object that also play a part in comparison of objects. If a class does not define an :meth:`__eq__` method it should not define a :meth:`__hash__` operation either; if it defines :meth:`__eq__` but not - :meth:`__hash__`, its instances will not be usable as dictionary keys. If a - class defines mutable objects and implements an :meth:`__eq__` method, it - should not implement :meth:`__hash__`, since the dictionary implementation - requires that a key's hash value is immutable (if the object's hash value - changes, it will be in the wrong hash bucket). + :meth:`__hash__`, its instances will not be usable as items in hashable + collections. If a class defines mutable objects and implements an + :meth:`__eq__` method, it should not implement :meth:`__hash__`, since the + implementation of hashable collections requires that a key's hash value is + immutable (if the object's hash value changes, it will be in the wrong hash + bucket). + User-defined classes have :meth:`__eq__` and :meth:`__hash__` methods by default; with them, all objects compare unequal (except with themselves) diff --git a/Doc/tools/sphinxext/download.html b/Doc/tools/sphinxext/download.html index 59aea630389..e5a25f7c23c 100644 --- a/Doc/tools/sphinxext/download.html +++ b/Doc/tools/sphinxext/download.html @@ -14,7 +14,7 @@

To download an archive containing all the documents for this version of Python in one of various formats, follow one of links in this table. The numbers -in the table are the size of the download files in Kilobytes.

+in the table are the size of the download files in megabytes.

@@ -54,7 +54,7 @@ platform. These are created on Unix using the InfoZIP zip program.

Problems

If you have comments or suggestions for the Python documentation, please send -email to docs@python.org.

+email to docs@python.org.

{% endif %} {% endblock %} diff --git a/Lib/doctest.py b/Lib/doctest.py index e8babd2c8f2..22052ec030b 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -847,12 +847,12 @@ class DocTestFinder: """ if module is None: return True + elif inspect.getmodule(object) is not None: + return module is inspect.getmodule(object) elif inspect.isfunction(object): return module.__dict__ is object.__globals__ elif inspect.isclass(object): return module.__name__ == object.__module__ - elif inspect.getmodule(object) is not None: - return module is inspect.getmodule(object) elif hasattr(object, '__module__'): return module.__name__ == object.__module__ elif isinstance(object, property):
FormatPacked as .zipPacked as .tar.bz2