• EOL

Python. Recipe. Edition III - David Beazley, Brian K. Jones

Index: KSZ-02306

" I'm sorry . Publisher: Helion. The book describesproven ways to solve the most common problems that occur when programming in Phyton language.

Python. Recipe. Edition III - David Beazley, Brian K. Jones
€20.40
€19.43 tax excl.
Unavailable
Discontinued product
PayPal payment
Manufacturer: Helion

Attention!

The sale of the product has been completed. Check otherdevices in this category.

Description

The book is the third edition of the popular "Recipes" series, where you can find proven solutions to the most common problems that arise when programming in Phyton.

From this book you will learn how to update programs written in the older version of Phyton 2 to the newer one - Phyton 3. You will also learn how to effectively operate on integers, data structures and character strings. You will also learn how to create your own functions and how to access files and networks. You will also learn how to use iterators and generators. Each "recipe" contains an example of code that you can use in your own projects, along with a comment and explanation of how the code works.

Examples of projects used in the book are availablefor download. Fragment of the book toread on-line.

Table of contents

Foreword (11)

1 Algorithms and data structures (15)

  • 1.1 Unpacking the sequence to separate variables (15)
  • 1.2 Unpacking from iterable objects of any length (16)
  • 1.3 Preservation of the last N elements (19)
  • 1.4 Search for N largest or smallest items (20)
  • 1.5 Creating a priority queue (22)
  • 1.6 Mapping keys to different values from a dictionary (24)
  • 1.7. Dictionary order definition (25)
  • 1.8 Calculation on dictionary data (26)
  • 1.9 Searching for identical data in two dictionaries (28)
  • 1.10. Deleting repetitions from the sequence in the order of the elements (29)
  • 1.11. Calling cuttings (30)
  • 1.12. Identification of the most common elements in a sequence (31)
  • 1.13. Sorting dictionary lists by common keys (33)
  • 1.14. Sorting of objects without built-in comparison support (34)
  • 1.15. Grouping of records based on field values (35)
  • 1.16. Filtering of sequence elements (37)
  • 1.17. Downloading a subset of the dictionary (39)
  • 1.18. Mapping of names into sequence elements (40)
  • 1.19. Simultaneous transformation and reduction of data (42)
  • 1.20. Combining multiple reproductions into one (43)

2 Character strings and text (47)

  • 2.1. the division of character strings upon detection of any of the different limiters (47)
  • 2.2 Fitting text to the beginning or end of a character string (48)
  • 2.3 Fitting character strings using shell ambiguous symbols (50)
  • 2.4 Matching and searching for text patterns (51)
  • 2.5 Text search and replacement (54)
  • 2.6 Searching for and substituting text without regard to case (55)
  • 2.7. Creating regular expressions for the shortest fit (56)
  • 2.8 Creation of regular expressions matching multiline patterns (57)
  • 2.9 Converting Unicode text into standard form (58)
  • 2.10. Use of Unicode characters in regular expressions (60)
  • 2.11. Removing unwanted characters from chains (61)
  • 2.12. Ensuring the correctness and ordering of text (62)
  • 2.13. Alignment of character strings (64)
  • 2.14. Combination of character strings (66)
  • 2.15. Value substitution for variables in character strings (68)
  • 2.16. Formatting of text to obtain a certain number of columns (70)
  • 2.17. Support for HTML and XML entities in text (71)
  • 2.18. Text-to-token breakdown (73)
  • 2.19. Creating a simple recursive descending parser (75)
  • 2.20. Performing text operations on byte strings (83)

3 Numbers, dates and time (87)

  • 3.1 Rounding of figures (87)
  • 3.2 Performing accurate calculations on decimal numbers (88)
  • 3.3 Formatting numbers for display (90)
  • 3.4 Using binary, octal and hexadecimal integers (92)
  • 3.5 Packing into bytes and unpacking from large integers in bytes (93)
  • 3.6 Calculation using composite numbers (95)
  • 3.7 Infinity and NaN values (96)
  • 3.8 Calculation using fractions (98)
  • 3.9. Calculation using large numerical tables (99)
  • 3.10. Performance of matrix and linear algebra operations (102)
  • 3.11. Random downloading (103)
  • 3.12. Conversion of days into seconds and other basic time-related conversions (105)
  • 3.13. Date of last Friday (107)
  • 3.14. Specifying the range of dates corresponding to the current month (108)
  • 3.15. Converting character strings into datetime objects (110)
  • 3.16. Date manipulation including time zones (111)

4. iterators and generators (113)

  • 4.1 Manual use of the iterator (113)
  • 4.2 Delegating the iteration process (114)
  • 4.3 Creating new iteration patterns using generators (115)
  • 4.4 Implementation of iterator protocol (117)
  • 4.5. Iterating in reverse order (119)
  • 4.6 Defining the function of generators with additional status (120)
  • 4.7 Downloading snippets of data returned by iterator (121)
  • 4.8 Skipping the first part of an iterable object (122)
  • 4.9. Iterating after all possible combinations or permutations (124)
  • 4.10. Passing through index-value sequence pairs (125)
  • 4.11. Passing through multiple sequences at once (127)
  • 4.12. Handling of items from separate containers (129)
  • 4.13. Creation of data processing streams (130)
  • 4.14. Conversion of nested sequences into one-dimensional form (133)
  • 4.15. Iterative sorting of integrated objects (134)
  • 4.16. Replacing infinite loops with an iterator (135)

5. input-output files and operations (137)

  • 5.1 Reading and writing text data (137)
  • 5.2 Saving data from print() to file (139)
  • 5.3 Using non-standard separators or line ends in print() (140)
  • 5.4 Reading and writing binary data (141)
  • 5.5 Save data to a file that does not exist (142)
  • 5.6 Performing entry-exit operations on chains (143)
  • 5.7 Reading and saving compressed data files (144)
  • 5.8. Moving to fixed size records (145)
  • 5.9 Loading binary data into a variable buffer (146)
  • 5.10. Binary file mapping in memory (148)
  • 5.11. Path manipulation (150)
  • 5.12. Checking that the file exists (151)
  • 5.13. Downloading list of catalogue contents (152)
  • 5.14. Not including file name encoding (153)
  • 5.15. Displaying incorrect file names (154)
  • 5.16. Adding or changing the open file encoding (156)
  • 5.17. Saving bytes to a text file (158)
  • 5.18. Placing the descriptor of an existing file in a file object (159)
  • 5.19. Creating temporary files and directories (160)
  • 5.20. Communication with serial ports (162)
  • 5.21. Python's serialisation of objects (163)

6 Coding and data processing (167)

  • 6.1 Uploading and saving CSV data (167)
  • 6.2 Loading and saving data in JSON format (170)
  • 6.3 Simple data parsing in XML (174)
  • 6.4 Gradual parsing of very large XML files (176)
  • 6.5. Converting dictionaries into XML format (179)
  • 6.6 Parsing, modifying and rewriting XML documents (181)
  • 6.7 Parsing XML documents with namespaces (183)
  • 6.8 Communication with relational databases (185)
  • 6.9 Decoding and encoding hexadecimal digits (187)
  • 6.10. Decoding and encoding of values in Base64 format (188)
  • 6.11. Reading and writing binary tables containing structures (188)
  • 6.12. Loading of nested binary structures of variable length (192)
  • 6.13. Summary of data and calculation of statistics (200)

7. functions (203)

  • 7.1 Writing functions accepting any number of arguments (203)
  • 7.2 Creation of functions that accept arguments provided exclusively by means of keywords (204)
  • 7.3 Attaching metadata with information to function arguments (205)
  • 7.4 Multi-value return by function (206)
  • 7.5 Defining functions with default arguments (207)
  • 7.6 Defining anonymous (intra-line) functions (210)
  • 7.7 Downloading variable values in anonymous functions (211)
  • 7.8 Activation of the n-argument call unit with fewer arguments (212)
  • 7.9. Substitution of classes with one method of function (215)
  • 7.10. Additional status in callback functions (216)
  • 7.11. Internal recording of callable functions (219)
  • 7.12. Access to variables defined at closure (221)

8 Classes and facilities (225)

  • 8.1 Modifying the textual representation of objects (225)
  • 8.2 Modifying the formatting of character strings (226)
  • 8.3 Adding a context management protocol to the support objects (228)
  • 8.4 Reducing memory consumption when creating a large number of objects (230)
  • 8.5. Hermetisation of names in class (231)
  • 8.6 Create managed attributes (232)
  • 8.7 Calling base class methods (236)
  • 8.8 Extension of properties in the derived class (240)
  • 8.9 Creating a new type of class or copy attribute (243)
  • 8.10. Using properties calculated in a lazy way (246)
  • 8.11. Simplifying the process of data structure initiation (248)
  • 8.12. Defining an interface or abstract base class (251)
  • 8.13. Creating a data model or type system (254)
  • 8.14. Creation of non-standard containers (259)
  • 8.15. Delegation of attribute access handling (262)
  • 8.16. Defining more than one constructor in class (266)
  • 8.17. Creating objects without calling the __init__() method (267)
  • 8.18. Extension of classes using mixed classes (269)
  • 8.19. Implementation of state owned facilities or machinery (273)
  • 8.20. Calling object methods by name in the character string (278)
  • 8.21. Implementation of the Visitors' Pattern (279)
  • 8.22. Implementation of the Visitor Pattern without re-competition (283)
  • 8.23. Memory management in cyclic data structures (288)
  • 8.24. Creating classes with comparison support (291)
  • 8.25. Creating cached objects (293)

9. metaprogramming (297)

  • 9.1 Creating function overlays (297)
  • 9.2 Keeping the metadata of functions when writing decorators (299)
  • 9.3 Downloading the original function from an overlay (300)
  • 9.4 Creating decorators accepting arguments (302)
  • 9.5 Defining a decorator with user-adapted attributes (303)
  • 9.6 Defining decorators accepting an optional argument (306)
  • 9.7 Forcing type checking in function with a decorator (307)
  • 9.8 Defining decorators as class elements (311)
  • 9.9 Defining decorators as classes (312)
  • 9.10. Use of decorators for class methods and static methods (315)
  • 9.11. Writing decorators that add arguments to the function in the caps (316)
  • 9.12. Use of decorators to improve class definitions (319)
  • 9.13. Using metaclass to control the creation of objects (320)
  • 9.14. Checking the order of defining the class attributes (323)
  • 9.15. Definition of metaclasses accepting optional arguments (325)
  • 9.16. Checking the signature on the basis of *args and **quargs (327) arguments
  • 9.17. Enforcement of class code writing conventions (330)
  • 9.18. Programmatic definition of classes (332)
  • 9.19. Initiation of class components in place of class definition (335)
  • 9.20. Overload of methods using function notes (337)
  • 9.21. Avoidance of repetitive property methods (342)
  • 9.22. Defining context managers easily (344)
  • 9.23. Execution of code causing local side effects (346)
  • 9.24. Python source code parsing and analysis (348)
  • 9.25. Python byte code disassembly (351)

10 Modules and packages (355)

  • 10.1 Creating hierarchical packages with modules (355)
  • 10.2 Control the import of all symbols (356)
  • 10.3 Importing slave modules from a package using relative names (357)
  • 10.4 Splitting the module into several files (358)
  • 10.5 Creating separate directories with imported code from one namespace (361)
  • 10.6 Re-loading the modules (362)
  • 10.7 Enabling code execution from a directory or zip file as the main script (364)
  • 10.8 Loading the data file from the package (365)
  • 10.9 Adding directories to the sys.path variable (366)
  • 10.10. Importing modules by name from a character string (367)
  • 10.11. Loading modules from a remote computer using hooks in the import command (368)
  • 10.12. Modification of modules during import (382)
  • 10.13. Installation of packages for own use only (384)
  • 10.14. Creating a new Python environment (385)
  • 10.15. Distribution of packages (386)

11. networks and development of network applications (389)

  • 11.1 Interaction with HTTP services via client code (389)
  • 11.2 Creating a TCP server (393)
  • 11.3 Creating a UDP server (395)
  • 11.4 Generating IP address ranges based on CIDR address (397)
  • 11.5 Creating a simple interface based on REST architecture (399)
  • 11.6 Support for simple remote procedure calls via XML-RPC (403)
  • 11.7 Simple communication between interpreters (405)
  • 11.8 Implementation of remote procedure calls (407)
  • 11.9 Simple customer authentication (410)
  • 11.10. Adding SSL support to network services (412)
  • 11.11. Forwarding socket file descriptor between processes (417)
  • 11.12. Event-driven input/output operations (422)
  • 11.13. Sending and receiving large boards (427)

12 Concurrency (429)

  • 12.1 Starting and stopping threads (429)
  • 12.2 Determining whether the thread has started (432)
  • 12.3 Communication between threads (434)
  • 12.4 Blocking the critical section (439)
  • 12.5 Blocking with avoidance of jamming (441)
  • 12.6 Recording of thread status (445)
  • 12.7 Creating a thread pool (446)
  • 12.8 Simple parallel programming (449)
  • 12.9 How to deal with the GIL mechanism (and stop worrying about it) (453)
  • 12.10. Definition of tasks acting as actors (456)
  • 12.11. Publish-subscribe model message transmission (459)
  • 12.12. Use of generators instead of threads (462)
  • 12.13. Questioning multiple thread queues (468)
  • 12.14. Start-up of the Demon process in Unix (471)

13 Tool scripts and system management (475)

  • 13.1 Accepting script input using redirections, streams or input files (475)
  • 13.2 Finishing the program with an error message (476)
  • 13.3 Command line option parsing (477)
  • 13.4 Password request during program execution (479)
  • 13.5 Downloading terminal sizes (480)
  • 13.6 Calling external commands and downloading output (481)
  • 13.7 Copying or moving files and folders (482)
  • 13.8 Creation and unpacking of archives (484)
  • 13.9 Searching for files by name (485)
  • 13.10. Loading configuration files (486)
  • 13.11. Adding an operation logging mechanism to simple scripts (489)
  • 13.12. Adding registration support to libraries (491)
  • 13.13. Creating a stopwatch (493)
  • 13.14. Setting memory and CPU usage limits (494)
  • 13.15. Starting the web browser (495)

14 Testing, debugging and exceptions (497)

  • 14.1 Testing of output data sent to stdout stream (497)
  • 14.2 Objects to be placed in unit tests (498)
  • 14.3 Exception checks in unit tests (501)
  • 14.4 Saving test output to file (503)
  • 14.5 Skipping tests or anticipating their failure (504)
  • 14.6 Multiple exception handling (505)
  • 14.7 Interception of all exceptions (507)
  • 14.8 Creating custom exceptions (508)
  • 14.9 Exception reporting in response to another exception (510)
  • 14.10. Re-notification of the last exception (512)
  • 14.11. Display of warning messages (513)
  • 14.12. Debugging simple program failures (514)
  • 14.13. Profiling and measurement of program operating time (516)
  • 14.14. Accelerating the programmes (518)

15. extensions in C language (525)

  • 15.1 Access to the C code using the ctypes module (526)
  • 15.2 Writing simple extension modules in C language (532)
  • 15.3 Writing the functions of extensions manipulating boards (535)
  • 15.4 Management of opaque indicators in C-language extension modules (538)
  • 15.5 Defining and exporting C APIs in extension modules (540)
  • 15.6 Calling Python code in C code (544)
  • 15.7 Release of GIL lock in C-language extensions (548)
  • 15.8 Simultaneous execution of C and Python code threads (549)
  • 15.9 Placing the C code in Swig-based overlays (550)
  • 15.10. Using Cython to create overlays on an existing C-language code (555)
  • 15.11. Using Cython to write efficient blackboard operations (560)
  • 15.12. Converting the pointer to function into a call unit (564)
  • 15.13. Forwarding character strings ending in NULL to C libraries (565)
  • 15.14. Forwarding Unicode character strings to C libraries (569)
  • 15.15. Conversion of character strings from C to Python (573)
  • 15.16. Use of strings of characters with unknown encoding taken from C (574)
  • 15.17. Forwarding file names for C extensions (577)
  • 15.18. Forwarding open files to C extensions (578)
  • 15.19. Loading data in C language from file-like objects (579)
  • 15.20. Downloading iterable objects in C language (581)
  • 15.21. Diagnosing segmentation errors (582)

A. Further reading (585)

Scorch (587)

Book - Author David Beazley, Brian K. Jones
Book - ISBN 978-83-246-8180-8
Book - Binding miękka
Book - Publisher Helion
Package width 0.001 cm
Package height 0.001 cm
Package depth 0.001 cm
Package weight 0.001 kg

Be the first to ask a question about this product!

Customers who bought this product also bought:

Products from the same category: