From 39c6ea6503526ee07a0b6b7f86487f1c0c3bc48a Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Tue, 21 Jun 2011 20:03:50 -0400 Subject: [PATCH] lpop/rpop --- tablib/core.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tablib/core.py b/tablib/core.py index 054d542..e93d454 100644 --- a/tablib/core.py +++ b/tablib/core.py @@ -571,7 +571,16 @@ class Dataset(object): self.rpush(row, tags) - def pop(self): + def lpop(self): + """Removes and returns the first row of the :class:`Dataset`.""" + + cache = self[0] + del self[0] + + return cache + + + def rpop(self): """Removes and returns the last row of the :class:`Dataset`.""" cache = self[-1] @@ -580,6 +589,12 @@ class Dataset(object): return cache + def pop(self): + """Removes and returns the last row of the :class:`Dataset`.""" + + return self.rpop() + + # ------- # Columns # -------