[Numpy-svn] r6020 - in trunk/numpy/lib: . tests

numpy-svn@scip... numpy-svn@scip...
Wed Nov 12 14:42:56 CST 2008


Author: dhuard
Date: 2008-11-12 14:42:53 -0600 (Wed, 12 Nov 2008)
New Revision: 6020

Modified:
   trunk/numpy/lib/function_base.py
   trunk/numpy/lib/tests/test_function_base.py
Log:
Follow up on changes to histogram: new=False now raises a DeprecationWarning, new=True warns users that `new` will disappear in 1.4.

Modified: trunk/numpy/lib/function_base.py
===================================================================
--- trunk/numpy/lib/function_base.py	2008-11-12 12:39:18 UTC (rev 6019)
+++ trunk/numpy/lib/function_base.py	2008-11-12 20:42:53 UTC (rev 6020)
@@ -225,10 +225,13 @@
         The `weights` keyword is only available with `new` set to True.
     new : {None, True, False}, optional
         Whether to use the new semantics for histogram:
-          * None : the new behaviour is used, and a warning is printed,
-          * True : the new behaviour is used and no warning is printed,
-          * False : the old behaviour is used and a message is printed
-              warning about future deprecation.
+          * None : the new behaviour is used, no warning is printed.
+          * True : the new behaviour is used and a warning is raised about
+            the future removal of the `new` keyword.
+          * False : the old behaviour is used and a DeprecationWarning 
+            is raised.
+        As of NumPy 1.3, this keyword should not be used explicitly since it 
+        will disappear in NumPy 1.4. 
 
     Returns
     -------
@@ -264,18 +267,11 @@
     # Old behavior
     if new == False:
         warnings.warn("""
-        The original semantics of histogram is scheduled to be
-        deprecated in NumPy 1.3. The new semantics fixes
-        long-standing issues with outliers handling. The main
-        changes concern
-        1. the definition of the bin edges,
-           now including the rightmost edge, and
-        2. the handling of upper outliers,
-           now ignored rather than tallied in the rightmost bin.
+        The histogram semantics being used is now deprecated and 
+        will disappear in NumPy 1.4.  Please update your code to 
+        use the default semantics. 
+        """, DeprecationWarning)
 
-        Please read the docstring for more information.
-        """, Warning)
-
         a = asarray(a).ravel()
 
         if (range is not None):
@@ -322,24 +318,10 @@
 
     # New behavior
     elif new in [True, None]:
-        if new is None:
+        if new is True:
             warnings.warn("""
-            The semantics of histogram has been modified in
-            the current release to fix long-standing issues with
-            outliers handling. The main changes concern
-            1. the definition of the bin edges,
-               now including the rightmost edge, and
-            2. the handling of upper outliers, now ignored rather
-               than tallied in the rightmost bin.
-            The previous behaviour is still accessible using
-            `new=False`, but is scheduled to be deprecated in the
-            next release (1.3).
-
-            *This warning will not printed in the 1.3 release.*
-
-            Use `new=True` to bypass this warning.
-
-            Please read the docstring for more information.
+            The new semantics of histogram is now the default and the `new` 
+            keyword will be removed in NumPy 1.4. 
             """, Warning)
         a = asarray(a)
         if weights is not None:

Modified: trunk/numpy/lib/tests/test_function_base.py
===================================================================
--- trunk/numpy/lib/tests/test_function_base.py	2008-11-12 12:39:18 UTC (rev 6019)
+++ trunk/numpy/lib/tests/test_function_base.py	2008-11-12 20:42:53 UTC (rev 6020)
@@ -439,7 +439,7 @@
 
 class TestHistogram(TestCase):
     def setUp(self):
-        warnings.simplefilter('ignore', Warning)
+        warnings.simplefilter('ignore', DeprecationWarning)
 
     def tearDown(self):
         warnings.resetwarnings()



More information about the Numpy-svn mailing list