summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Shorin <kxepal@apache.org>2013-11-12 08:17:14 +0400
committerAlexander Shorin <kxepal@apache.org>2013-11-12 08:17:14 +0400
commitcbe80b0d7cb8ce12d6f65031a4fab9f9398db701 (patch)
treecaef86cc184f4367e572fa1fb05d3c337fc64725
parent3206a73fccb68f9d615b297d6c515848272efc53 (diff)
downloadpython-json-patch-cbe80b0d7cb8ce12d6f65031a4fab9f9398db701.tar.gz
Use reversed(range) is recommended over range with negative step
https://mail.python.org/pipermail/python-ideas/2013-October/023733.html
-rw-r--r--jsonpatch.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/jsonpatch.py b/jsonpatch.py
index 926c729..e70a85c 100644
--- a/jsonpatch.py
+++ b/jsonpatch.py
@@ -323,8 +323,7 @@ class JsonPatch(object):
'path': '/'.join(current),
'value': dst[idx]}
elif lsrc > ldst:
- # more effective than reversed(range(ldst, lsrc))
- for idx in range(lsrc - 1, ldst - 1 , -1):
+ for idx in reversed(range(ldst, lsrc)):
yield {'op': 'remove', 'path': '/'.join(path + [str(idx)])}
return cls(list(compare_dict([''], src, dst)))