From abdf8d885895e5cd96dd2f2746c902068d5b8bad Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 5 Nov 2007 13:49:25 -0600 Subject: [PATCH] Add len_iterable(). --- src/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/__init__.py b/src/__init__.py index 6c8aea6..4403bb6 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -155,6 +155,15 @@ class DependentDictionary(object): +def len_iterable(iterable): + result = 0 + for i in iterable: + result += 1 + return result + + + + def add_tuples(t1, t2): return tuple([t1v + t2v for t1v, t2v in zip(t1, t2)]) -- GitLab