From: Philipp Hagemeister Date: Wed, 22 Jan 2014 20:43:33 +0000 (+0100) Subject: Add __len__ to PagedLists X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=dd26ced164f834a337956ab57a014a8afd8b9131;p=youtube-dl Add __len__ to PagedLists --- diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index ed5ee222f..8fa4cb67f 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1172,6 +1172,10 @@ class PagedList(object): self._pagefunc = pagefunc self._pagesize = pagesize + def __len__(self): + # This is only useful for tests + return len(self.getslice()) + def getslice(self, start=0, end=None): res = [] for pagenum in itertools.count(start // self._pagesize):