Skip to Content
Functional Python Programming - Second Edition
book

Functional Python Programming - Second Edition

by Steven F. Lott
April 2018
Intermediate to advanced content levelIntermediate to advanced
408 pages
10h 42m
English
Packt Publishing
Content preview from Functional Python Programming - Second Edition

The complete analysis process

Here is the composite analysis() function that digests a collection of log files:

def analysis(filename: str) -> Dict[str, int]:    """Count book chapters in a given log"""    details = path_filter(        access_detail_iter(            access_iter(                local_gzip(filename))))    books = book_filter(details)    totals = reduce_book_total(books)    return totalsWe've defined a rule, through the book_in_path() function, which we'll apply to each 

The analysis() function uses the local_gzip() function to work with a single filename or file pattern. It applies a standard set of parsing functions, path_filter(), access_detail_iter(), and access_iter(), to create an iterable sequence of AccessDetails objects. It then applies our analytical filter and ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Functional Python Programming - Third Edition

Functional Python Programming - Third Edition

Steven F. Lott

Publisher Resources

ISBN: 9781788627061Supplemental Content