Hi,

While looking at axes.py for the color/edgecolor patch just sent, I
noticed the FIXME suggesting ValueError instead of assert.  Is the below
the kind of thing?

Ben.




--- ORIG-axes.py        2010-07-06 15:43:35.000000000 +0100
+++ NEW-axes.py 2010-08-09 09:43:30.000257000 +0100
@@ -4589,15 +4589,12 @@
             if len(edgecolor) < nbars:
                 edgecolor *= nbars

-        # FIXME: convert the following to proper input validation
-        # raising ValueError; don't use assert for this.
-        assert len(left)==nbars, "incompatible sizes: argument 'left'
must be length %d or scalar" % nbars
-        assert len(height)==nbars, ("incompatible sizes: argument
'height' must be length %d or scalar" %
-                                    nbars)
-        assert len(width)==nbars, ("incompatible sizes: argument
'width' must be length %d or scalar" %
-                                   nbars)
-        assert len(bottom)==nbars, ("incompatible sizes: argument
'bottom' must be length %d or scalar" %
-                                    nbars)
+        for argname in ['left', 'height', 'width', 'bottom']:
+            arg = locals()[argname]
+            if len(arg) != nbars:
+                raise ValueError("incompatible sizes:"
+                                 " argument '%s' must be length %d or scalar"
+                                 % (argname, nbars))

         patches = []

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to