diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-05-08 22:27:58 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-05-08 22:27:58 (GMT) |
commit | 699adb9cd8efe80c99fb7d2815286aa026d83b91 (patch) | |
tree | a560ce03234802ef11d373ea3b78ac11a7f23a4b /Doc/library | |
parent | cf7d175ec44be1703839b83bf420501ada5f8fb7 (diff) | |
download | cpython-699adb9cd8efe80c99fb7d2815286aa026d83b91.zip cpython-699adb9cd8efe80c99fb7d2815286aa026d83b91.tar.gz cpython-699adb9cd8efe80c99fb7d2815286aa026d83b91.tar.bz2 |
Merged revisions 62873,62887,62892-62896,62904 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62873 | raymond.hettinger | 2008-05-08 12:18:13 -0500 (Thu, 08 May 2008) | 1 line
Issue 2778. Document the temporary frozenset swap in __contains__(), remove(), and discard().
........
r62887 | brett.cannon | 2008-05-08 14:50:51 -0500 (Thu, 08 May 2008) | 5 lines
Make test.test_support.catch_warning() take an argument specifying if any
triggered warnings should be captured. This allows the context manager to be
used to just prevent the internal state of the 'warnings' framework and thus
allow triggered warnings to be displayed.
........
r62892 | brett.cannon | 2008-05-08 15:20:24 -0500 (Thu, 08 May 2008) | 4 lines
Fix a bug introduced by the addition of the 'record' argument to
test.test_support.catch_warning() where showwarning() was not being set
properly.
........
r62893 | brett.cannon | 2008-05-08 15:20:54 -0500 (Thu, 08 May 2008) | 2 lines
Document the 'record' argument for test.test_support.catch_warning().
........
r62894 | brett.cannon | 2008-05-08 15:23:06 -0500 (Thu, 08 May 2008) | 4 lines
Fix sys.flags to properly expose bytes_warning.
Closes issue #2790.
........
r62895 | brett.cannon | 2008-05-08 15:23:54 -0500 (Thu, 08 May 2008) | 2 lines
Add a missing entry on the fix for issue #2790.
........
r62896 | brett.cannon | 2008-05-08 15:24:43 -0500 (Thu, 08 May 2008) | 2 lines
Add test.test_support.catch_warning()'s new argument.
........
r62904 | benjamin.peterson | 2008-05-08 17:09:54 -0500 (Thu, 08 May 2008) | 2 lines
Replace instances of os.path.walk with os.walk
........
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/stdtypes.rst | 20 | ||||
-rw-r--r-- | Doc/library/test.rst | 10 |
2 files changed, 19 insertions, 11 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 14aa28d..c97e9ae 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1539,7 +1539,7 @@ proper superset of the second set (is a superset, but is not equal). Instances of :class:`set` are compared to instances of :class:`frozenset` based on their members. For example, ``set('abc') == frozenset('abc')`` returns -``True``. +``True`` and so does ``set('abc') in set([frozenset('abc')])``. The subset and equality comparisons do not generalize to a complete ordering function. For example, any two disjoint sets are not equal and are not subsets @@ -1578,18 +1578,18 @@ apply to immutable instances of :class:`frozenset`: Update the set, keeping only elements found in either set, but not in both. -.. method:: set.add(el) +.. method:: set.add(elem) - Add element *el* to the set. + Add element *elem* to the set. -.. method:: set.remove(el) +.. method:: set.remove(elem) - Remove element *el* from the set. Raises :exc:`KeyError` if *el* is not + Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not contained in the set. -.. method:: set.discard(el) +.. method:: set.discard(elem) - Remove element *el* from the set if it is present. + Remove element *elem* from the set if it is present. .. method:: set.pop() @@ -1606,6 +1606,12 @@ Note, the non-operator versions of the :meth:`update`, :meth:`symmetric_difference_update` methods will accept any iterable as an argument. +Note, the *elem* argument to the :meth:`__contains__`, :meth:`remove`, and +:meth:`discard` methods may be a set. To support searching for an equivalent +frozenset, the *elem* set is temporarily mutated during the search and then +restored. During the search, the *elem* set should not be read or mutated +since it does not have a meaningful value. + .. _typesmapping: diff --git a/Doc/library/test.rst b/Doc/library/test.rst index 6c35d50..a6a3584 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -283,13 +283,15 @@ The :mod:`test.test_support` module defines the following functions: This will run all tests defined in the named module. -.. function:: catch_warning() +.. function:: catch_warning(record=True) - This is a context manager that guards the warnings filter from being + Return a context manager that guards the warnings filter from being permanently changed and records the data of the last warning that has been - issued. + issued. The ``record`` argument specifies whether any raised warnings are + captured by the object returned by :func:`warnings.catch_warning` or allowed + to propagate as normal. - Use like this:: + The context manager is typically used like this:: with catch_warning() as w: warnings.warn("foo") |