本站支持尊重有效期内的版权/著作权,所有的资源均来自于互联网网友分享或网盘资源,一旦发现资源涉及侵权,将立即删除。希望所有用户一同监督并反馈问题,如有侵权请联系站长或发送邮件到ebook666@outlook.com,本站将立马改正
商品基本信息,请以下列介绍为准 | |
商品名称: | 函数式Python编程 |
作者: | Steven F. Lott |
定价: | 99.0 |
出版社: | 东南大学出版社 |
出版日期: | 2019-05-01 |
ISBN: | 9787564183257 |
印次: | |
版次: | |
装帧: | |
开本: | 小16开 |
内容简介 | |
Python是一种计算机程序设计语言。是一种动态的、面向对象的脚本语言,*初被设计用于编写自动化脚本(shell),随着版本的不断更新和语能的添加,越来越多地被用于独立的、大型项目的开发。本书讲解python知识。 |
目录 | |
Copyright and Creditr>Preface Chapter 1: Understanding Functional Programming Identifying a paradigm Subdividing the procedural paradigm Using the functional paradigm Using a functional hybrid Lo at object creation The stack of turtler>A classic example of functional programming Exploratory data analysir>Summary Chapter 2: Introducing Essential Functional Conceptr>First-class functionr>Pure functionr>Higher-order functionr>Immutable data Strict and non-strict evaluation Recursion instead of an explicit loop state Functional type systemr>Familiar territory Learning some advanced conceptr>Summary Chapter 3: Functions, Iterators, and Generatorr>Writing pure functionr>Functions as first-clasjectr>Using stringr>Using tuples and named tupler>Using generator expressionr>Exploring the limitations of generatorr>Combining generator expressionr>Cleaning raw data with generator functionr>Using lists, dicts, and setr>Using stateful mappingr>Using the bisect module to create a mapping Using stateful setr>Summary Chapter 4: Wo with Collectionr>An overview of function varietier>Wo with iterabler>Parsing an XML file Parsing a file at a higher level Pairing up items from a sequence Using the iterO function explicitly Extending a simple loop Applying generator expressions to scalar functionr>Using any() and all() as reductionr>Using lenO and sum() Using sums and counts for statisticr>Using zip() to structure and flatten sequencer>Unzipping a zipped sequence Flattening sequencer>Structuring flat sequencer>Structuring flat sequences - an alternative approach Using reversed() to change the order Using enumerate() to include a sequence number Summary Chapter 5: Higher-Order Functionr>Using max() and min0 to find extrema Using Python lambda formr>Lambdas and the lambda calculur>Using the map() function to apply a function to a collection Wo with lambda forms and map() Using map() with multiple sequencer>Using the filter() function to pass or reject data Using filter() to identify outlierr>The iter0 function with a sentinel value Using sorted() to put data in order Writing higher-order functionr>Writing higher-order mappings and filterr>Unwrapping data while mapping Wrapping itional data while mapping Flattening data while mapping Structuring data while filtering Writing generator functionr>Building higher-order functions with callabler>Assuring good functional design Review of some design patternr>Summary Chapter 6: Recursions and Reductionr>Simple numerical recursionr>Implementing tail-call optimization Leaving recursion in place Handling difficult tail-call optimization Processing collections through recursion Tail-call optimization for collectionr>Reductions and folding a collection from many items to one Group-by reduction from many items to fewer Building a mapping with Counter Building a mapping by sorting Grouping or partitioning data by key valuer>Writing more general group-by reductionr>Writing higher-order reductionr>Writing file parserr>Parsing CSV filer>Parsing plain text files with headerr>Summary Chapter 7: itional Tuple Techniquer>Using tuples to collect data Using named tuples to collect data Building named tuples with functional constructorr>Avoiding stateful classey using families of tupler>Assigning statistical rankr>Wrapping instead of state changing Rewrapping instead of state changing Computing Spearman rank-order correlation Polymorphism and type-pattern matching Summary Chapter 8: The Itertools Module Wo with the infinite iteratorr>Counting with count() Counting with float argumentr>Re-iterating a cycle with cycle() Repeating a single value with repeat() Using the finite iteratorr>Assigning numbers with enumerate() Running totals with accumulate() Combining iterators with chain() Partitioning an iterator with groupby0 Merging iterables with zip_longest0 and zip() Filtering with compress() Pi sets with islice() Stateful filtering with dropwhile0 and takewhile0 Two approaches to filtering with filterfalse() and filter() Applying a function to data via starmap0 and map() Cloning iterators with tee() The itertools reciper>Summary Chapter 9: More Itertools Techniquer>Enumerating the Cartesian product Reducing a product Computing distancer>Getting all pixels and all colorr>Performance analysir>Rearranging the problem Combining two transformationr>Permuting a collection of valuer>Generating all combinationr>Reciper>Summary Chapter 10: The Functools Module Function toolr>Memoizing previous results with Iru_cache Defining classes with total ordering Defining number classer>Applying partial arguments with partial() Reducing sets of data with the reduce() function Combining map() and reduce() Using the reduce() and partial() functionr>Using the map() and reduce() functions to sanitize raw data Using the groupby0 and reduce() functionr>Summary Chapter 11: Decorator Design Techniquer>Decorators as higher-order functionr>Using the functools update_wrapper0 functionr>Cross-cutting concernr>Composite design Preprocessing bad data ing a parameter to a decorator Implementing more complex decoratorr>CompLex design considerationr>Summary Chapter 12: The Multiprocessing and Threading Moduler>Functional programming and concurrency What concurrency really meanr>The boundary conditionr>Sharing resources with process or threadr>Where benefits will accrue Using multiprocessing pools and taskr>Processing many large filer>Parsing log files - gathering the rowr>Parsing log lines into namedtupler>Parsing itional fields of an Accesject Filtering the access detailr>Analyzing the access detailr>The complete analysis procer>Using a multiprocessing pool for concurrent processing Using apply() to make a single requer>Using the map_async0, starmap_async(), and apply_async0 functionr>More complex multiprocessing architecturer>Using the concurrent.futures module Using concurrent.futures thread poolr>Using the threading and queue moduler>Designing concurrent processing Summary Chapter 13: Conditional Expressions and the Operator Module Evaluating conditional expressionr>Exploiting non-strict dictionary ruler>Filtering true conditional expressionr>Finding a matching pattern Using the operator module instead of lambdar>Getting named attributes when using higher-order functionr>Starmapping with operatorr>Reducing with operator module functionr>Summary Chapter 14: The PyMonad Library Downloading and installing Functional composition and currying Using curried higher-order functionr>Currying the hard way Functional composition and the PyMonad * operator Functors and applicative functorr>Using the lazy List() functor Monad bind() function and the >> operator Implementing simulation with monadr>itional PyMonad featurer>Summary Chapter 15: A Functional Approach to Web Servicer>The HTTP request-response model Injecting state through cookier>Considering a server with a functional design Lo more deeply into the functional view Nesting the servicer>The WSGI standard Throwing exceptions during WSGI processing Pragmatic WSGI applicationr>Defining web services as functionr>Creating the WSGI application Getting raw data Applying a filter Serializing the resultr>Serializing data into JSON or CSV formatr>Serializing data into XML Serializing data into HTML Tra usage Summary Chapter 16: Optimizations and Improvementr>Memoization and caching Specializing memoization Tail recursion optimizationr>Optimizing storage Optimizing accuracy Reducing accuracy based on audience requirementr>Case study-m a chi-squared decision Filtering and reducing the raw data with a Counter object Reading summarized data Computing sums with a Counter object Computing probabilities from Counter objectr>Computing expected values and displaying a contingency table Computing the chi-squared value Computing the chi-squared threshold Computing the incomplete gamma function Computing the complete gamma function Computing the s of a distribution being random Functional programming design patternr>Summary Other Books You May Enjoy Index |