Revision: 6217 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6217&view=rev Author: mmetz_bn Date: 2008-10-16 11:15:25 +0000 (Thu, 16 Oct 2008)
Log Message: ----------- minor optimizations: replacing range by xrange in for loops Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-10-15 20:53:09 UTC (rev 6216) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-10-16 11:15:25 UTC (rev 6217) @@ -243,7 +243,7 @@ x, y, multicol = self._xy_from_y(y) if multicol: - for j in range(y.shape[1]): + for j in xrange(y.shape[1]): color = self._get_next_cycle_color() seg = mlines.Line2D(x, y[:,j], color = color, @@ -285,7 +285,7 @@ ret.append(seg) if multicol: - for j in range(y.shape[1]): + for j in xrange(y.shape[1]): makeline(x[:,j], y[:,j]) else: makeline(x, y) @@ -324,7 +324,7 @@ closed = kwargs.get('closed', True) func = makefill if multicol: - for j in range(y.shape[1]): + for j in xrange(y.shape[1]): func(x[:,j], y[:,j]) else: func(x, y) @@ -372,7 +372,7 @@ func = makefill if multicol: - for j in range(y.shape[1]): + for j in xrange(y.shape[1]): func(x[:,j], y[:,j]) else: func(x, y) @@ -3897,9 +3897,9 @@ pass elif align == 'center': if orientation == 'vertical': - left = [left[i] - width[i]/2. for i in range(len(left))] + left = [left[i] - width[i]/2. for i in xrange(len(left))] elif orientation == 'horizontal': - bottom = [bottom[i] - height[i]/2. for i in range(len(bottom))] + bottom = [bottom[i] - height[i]/2. for i in xrange(len(bottom))] else: raise ValueError, 'invalid alignment: %s' % align @@ -4571,7 +4571,7 @@ elif nc == 1: x = [x.ravel()] else: - x = [x[:,i] for i in range(nc)] + x = [x[:,i] for i in xrange(nc)] else: raise ValueError, "input x can have no more than 2 dimensions" if not hasattr(x[0], '__len__'): @@ -4665,7 +4665,7 @@ else: def doplot(*args): shuffled = [] - for i in range(0, len(args), 3): + for i in xrange(0, len(args), 3): shuffled.extend([args[i+1], args[i], args[i+2]]) return self.plot(*shuffled) This 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 https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins