On Tue, Feb 23, 2016 at 2:38 AM, Arshpreet Singh <arsh...@gmail.com> wrote: >> next(filter(print, read_pdf("book.pdf")), None) > > Why we are w=using filter here?
It's a beautiful hack. It'll filter according to the "print" predicate, which always returns None, and will thus filter everything out. One single call to next() will thus process and print the entire PDF, and then - since it has a second parameter - return None instead of raising StopIteration. Or maybe it's a gross and ugly hack, with the exact same description. ChrisA -- https://mail.python.org/mailman/listinfo/python-list