lpop/rpop

This commit is contained in:
Kenneth Reitz
2011-06-21 20:03:50 -04:00
parent 39b66ad8e9
commit 39c6ea6503
+16 -1
View File
@@ -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
# -------