This isn't quite what I was suggesting (and seems to be equivalent to the code as before). In the common case where there are no units in the data, this will still traverse the entire list.
I think replacing the whole loop with:
converter = self.get_converter(iter(x).next())
would be even better. (Since lists of data should not be heterogeneous anyway...)
Mike
jdh2358@...189... wrote:
···
Revision: 6166
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6166&view=rev
Author: jdh2358
Date: 2008-10-07 15:13:53 +0000 (Tue, 07 Oct 2008)Log Message:
-----------
added michaels unit detection optimization for arraysModified Paths:
--------------
trunk/matplotlib/lib/matplotlib/units.pyModified: trunk/matplotlib/lib/matplotlib/units.py
--- trunk/matplotlib/lib/matplotlib/units.py 2008-10-07 15:13:13 UTC (rev 6165)
+++ trunk/matplotlib/lib/matplotlib/units.py 2008-10-07 15:13:53 UTC (rev 6166)
@@ -135,7 +135,7 @@
for thisx in x:
converter = self.get_converter( thisx )
- if converter: break
+ return converter
#DISABLED self._cached[idx] = converter
return converterThis was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
matplotlib-checkins List Signup and Options
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA