From 6783003eb2cbd71336afa2c1275fc1dc7d743b12 Mon Sep 17 00:00:00 2001
From: Francois Keith <keith@lirmm.fr>
Date: Tue, 16 Apr 2013 13:01:06 +0200
Subject: [PATCH] Correct the method objectToString and the handling of
 collections.

This corrects the issue detailed here:
https://github.com/jrl-umi3218/dynamic-graph-python/issues/2

Solution found by Florent Lamiraux.
---
 src/dynamic_graph/signal_base.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/dynamic_graph/signal_base.py b/src/dynamic_graph/signal_base.py
index 034b041..0e0ce5e 100644
--- a/src/dynamic_graph/signal_base.py
+++ b/src/dynamic_graph/signal_base.py
@@ -101,12 +101,12 @@ def objectToString(obj) :
       - an integer,
       - a boolean,
     """
-    if (isinstance(obj, collections.Iterable)) :
+    if (hasattr (obj, "__iter__")) :
         # matrix or vector
         if len(obj) is 0 :
             return ""
         else :
-            if (isinstance(obj[0], collections.Iterable)) :
+            if (hasattr(obj[0], "__iter__")) :
                 #matrix
                 return matrixToString(obj)
             else :
-- 
GitLab