Commit 660f77ce authored by Benjamin Peterson's avatar Benjamin Peterson

Merged revisions 67243,67245,67277-67278,67289 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67243 | benjamin.peterson | 2008-11-17 15:39:05 -0600 (Mon, 17 Nov 2008) | 1 line

  a few fixes on the download page
........
  r67245 | benjamin.peterson | 2008-11-17 16:05:19 -0600 (Mon, 17 Nov 2008) | 1 line

  improve __hash__ docs
........
  r67277 | skip.montanaro | 2008-11-18 21:35:41 -0600 (Tue, 18 Nov 2008) | 1 line

  patch from issue 1108
........
  r67278 | georg.brandl | 2008-11-19 01:59:09 -0600 (Wed, 19 Nov 2008) | 2 lines

  Try to fix problems with verbatim.
........
  r67289 | brett.cannon | 2008-11-19 14:29:39 -0600 (Wed, 19 Nov 2008) | 2 lines

  Ignore .pyc and .pyo files.
........
parent 17254ce9
...@@ -141,6 +141,8 @@ latex_preamble = r''' ...@@ -141,6 +141,8 @@ latex_preamble = r'''
\strong{Python Software Foundation}\\ \strong{Python Software Foundation}\\
Email: \email{docs@python.org} Email: \email{docs@python.org}
} }
\let\Verbatim=\OriginalVerbatim
\let\endVerbatim=\endOriginalVerbatim
''' '''
# Documents to append as an appendix to all manuals. # Documents to append as an appendix to all manuals.
......
...@@ -1202,20 +1202,22 @@ Basic customization ...@@ -1202,20 +1202,22 @@ Basic customization
object: dictionary object: dictionary
builtin: hash builtin: hash
Called for the key object for dictionary operations, and by the built-in Called by built-in function :func:`hash` and for operations on members of
function :func:`hash`. Should return an integer usable as a hash value hashed collections including :class:`set`, :class:`frozenset`, and
for dictionary operations. The only required property is that objects which :class:`dict`. :meth:`__hash__` should return an integer. The only required
compare equal have the same hash value; it is advised to somehow mix together property is that objects which compare equal have the same hash value; it is
(e.g., using exclusive or) the hash values for the components of the object that advised to somehow mix together (e.g. using exclusive or) the hash values for
also play a part in comparison of objects. 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 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__` operation either; if it defines :meth:`__eq__` but not
:meth:`__hash__`, its instances will not be usable as dictionary keys. If a :meth:`__hash__`, its instances will not be usable as items in hashable
class defines mutable objects and implements an :meth:`__eq__` method, it collections. If a class defines mutable objects and implements an
should not implement :meth:`__hash__`, since the dictionary implementation :meth:`__eq__` method, it should not implement :meth:`__hash__`, since the
requires that a key's hash value is immutable (if the object's hash value implementation of hashable collections requires that a key's hash value is
changes, it will be in the wrong hash bucket). 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 User-defined classes have :meth:`__eq__` and :meth:`__hash__` methods
by default; with them, all objects compare unequal (except with themselves) by default; with them, all objects compare unequal (except with themselves)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<p>To download an archive containing all the documents for this version of <p>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 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.</p> in the table are the size of the download files in megabytes.</p>
<table class="docutils"> <table class="docutils">
<tr><th>Format</th><th>Packed as .zip</th><th>Packed as .tar.bz2</th></tr> <tr><th>Format</th><th>Packed as .zip</th><th>Packed as .tar.bz2</th></tr>
...@@ -54,7 +54,7 @@ platform. These are created on Unix using the InfoZIP zip program.</p> ...@@ -54,7 +54,7 @@ platform. These are created on Unix using the InfoZIP zip program.</p>
<h2>Problems</h2> <h2>Problems</h2>
<p>If you have comments or suggestions for the Python documentation, please send <p>If you have comments or suggestions for the Python documentation, please send
email to <a href="docs@python.org">docs@python.org</a>.</p> email to <a href="mailto:docs@python.org">docs@python.org</a>.</p>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
...@@ -847,12 +847,12 @@ class DocTestFinder: ...@@ -847,12 +847,12 @@ class DocTestFinder:
""" """
if module is None: if module is None:
return True return True
elif inspect.getmodule(object) is not None:
return module is inspect.getmodule(object)
elif inspect.isfunction(object): elif inspect.isfunction(object):
return module.__dict__ is object.__globals__ return module.__dict__ is object.__globals__
elif inspect.isclass(object): elif inspect.isclass(object):
return module.__name__ == object.__module__ return module.__name__ == object.__module__
elif inspect.getmodule(object) is not None:
return module is inspect.getmodule(object)
elif hasattr(object, '__module__'): elif hasattr(object, '__module__'):
return module.__name__ == object.__module__ return module.__name__ == object.__module__
elif isinstance(object, property): elif isinstance(object, property):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment