summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jsonpointer.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/jsonpointer.py b/jsonpointer.py
index 05ccd92..b6d1430 100644
--- a/jsonpointer.py
+++ b/jsonpointer.py
@@ -223,7 +223,17 @@ class JsonPointer(object):
def pairwise(iterable):
- "s -> (s0,s1), (s1,s2), (s2, s3), ..."
+ """ s -> (s0,s1), (s1,s2), (s2, s3), ...
+
+ >>> list(pairwise([]))
+ []
+
+ >>> list(pairwise([1]))
+ []
+
+ >>> list(pairwise([1, 2, 3, 4]))
+ [(1, 2), (2, 3), (3, 4)]
+ """
a, b = tee(iterable)
for _ in b:
break