|
From: <ef...@us...> - 2008-09-28 03:07:13
|
Revision: 6128
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6128&view=rev
Author: efiring
Date: 2008-09-28 03:07:04 +0000 (Sun, 28 Sep 2008)
Log Message:
-----------
fixed cbook.flatten so its docstring example works
Previously, flatten(('a','b')) triggered infinite recursion.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2008-09-28 00:44:08 UTC (rev 6127)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2008-09-28 03:07:04 UTC (rev 6128)
@@ -318,7 +318,10 @@
return fh, opened
return fh
-def flatten(seq, scalarp=is_scalar):
+def is_scalar_or_string(val):
+ return is_string_like(val) or not iterable(val)
+
+def flatten(seq, scalarp=is_scalar_or_string):
"""
this generator flattens nested containers such as
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|