mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-28 10:56:18 +03:00
Merge pull request #1796 from radarhere/pildriver
Minor pildriver code rearrangement
This commit is contained in:
commit
c4233fd668
|
@ -70,7 +70,7 @@ class PILDriver(object):
|
||||||
|
|
||||||
def push(self, item):
|
def push(self, item):
|
||||||
"Push an argument onto the evaluation stack."
|
"Push an argument onto the evaluation stack."
|
||||||
self.stack = [item] + self.stack
|
self.stack.insert(0, item)
|
||||||
|
|
||||||
def top(self):
|
def top(self):
|
||||||
"Return the top-of-stack element."
|
"Return the top-of-stack element."
|
||||||
|
@ -90,9 +90,7 @@ class PILDriver(object):
|
||||||
|
|
||||||
Discard the top element on the stack.
|
Discard the top element on the stack.
|
||||||
"""
|
"""
|
||||||
top = self.stack[0]
|
return self.stack.pop(0)
|
||||||
self.stack = self.stack[1:]
|
|
||||||
return top
|
|
||||||
|
|
||||||
def do_dup(self):
|
def do_dup(self):
|
||||||
"""usage: dup
|
"""usage: dup
|
||||||
|
@ -103,7 +101,7 @@ class PILDriver(object):
|
||||||
dup = self.stack[0].copy()
|
dup = self.stack[0].copy()
|
||||||
else:
|
else:
|
||||||
dup = self.stack[0]
|
dup = self.stack[0]
|
||||||
self.stack = [dup] + self.stack
|
self.push(dup)
|
||||||
|
|
||||||
def do_swap(self):
|
def do_swap(self):
|
||||||
"""usage: swap
|
"""usage: swap
|
||||||
|
|
Loading…
Reference in New Issue
Block a user