diff options
author | Raymond Hettinger <python@rcn.com> | 2002-06-30 03:39:14 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2002-06-30 03:39:14 (GMT) |
commit | 46ac8eb3c899b498299a2f8fbcdd4ed3f32addba (patch) | |
tree | bcbe8646fceabec7bcdc4c365f6389fb537fdb68 /Lib/pickle.py | |
parent | 78e057a32a92c3bfb464b27a02f4931c474769e8 (diff) | |
download | cpython-46ac8eb3c899b498299a2f8fbcdd4ed3f32addba.zip cpython-46ac8eb3c899b498299a2f8fbcdd4ed3f32addba.tar.gz cpython-46ac8eb3c899b498299a2f8fbcdd4ed3f32addba.tar.bz2 |
Code modernization. Replace v=s[i]; del s[i] with single lookup v=s.pop(i)
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r-- | Lib/pickle.py | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py index f29df51..e553920 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -692,11 +692,7 @@ class Unpickler: dispatch[PERSID] = load_persid def load_binpersid(self): - stack = self.stack - - pid = stack[-1] - del stack[-1] - + pid = self.stack.pop() self.append(self.persistent_load(pid)) dispatch[BINPERSID] = load_binpersid @@ -977,8 +973,7 @@ class Unpickler: def load_append(self): stack = self.stack - value = stack[-1] - del stack[-1] + value = stack.pop() list = stack[-1] list.append(value) dispatch[APPEND] = load_append @@ -995,9 +990,8 @@ class Unpickler: def load_setitem(self): stack = self.stack - value = stack[-1] - key = stack[-2] - del stack[-2:] + value = stack.pop() + key = stack.pop() dict = stack[-1] dict[key] = value dispatch[SETITEM] = load_setitem @@ -1014,8 +1008,7 @@ class Unpickler: def load_build(self): stack = self.stack - value = stack[-1] - del stack[-1] + value = stack.pop() inst = stack[-1] try: setstate = inst.__setstate__ @@ -1038,8 +1031,7 @@ class Unpickler: dispatch[MARK] = load_mark def load_stop(self): - value = self.stack[-1] - del self.stack[-1] + value = self.stack.pop() raise _Stop(value) dispatch[STOP] = load_stop |