Python Cookbook Author: Brian K. Jones | Language: English | ISBN:
B00DQV4GGY | Format: EPUB
Python Cookbook Description
If you need help writing programs in Python 3, or want to update older Python 2 code, this book is just the ticket. Packed with practical recipes written and tested with Python 3.3, this unique cookbook is for experienced Python programmers who want to focus on modern tools and idioms.
Inside, you’ll find complete recipes for more than a dozen topics, covering the core Python language as well as tasks common to a wide variety of application domains. Each recipe contains code samples you can use in your projects right away, along with a discussion about how and why the solution works.
Topics include:
- Data Structures and Algorithms
- Strings and Text
- Numbers, Dates, and Times
- Iterators and Generators
- Files and I/O
- Data Encoding and Processing
- Functions
- Classes and Objects
- Metaprogramming
- Modules and Packages
- Network and Web Programming
- Concurrency
- Utility Scripting and System Administration
- Testing, Debugging, and Exceptions
- C Extensions
- File Size: 1707 KB
- Print Length: 708 pages
- Simultaneous Device Usage: Unlimited
- Publisher: O'Reilly Media; 3 edition (May 10, 2013)
- Sold by: Amazon Digital Services, Inc.
- Language: English
- ASIN: B00DQV4GGY
- Text-to-Speech: Enabled
X-Ray:
- Lending: Not Enabled
- Amazon Best Sellers Rank: #71,678 Paid in Kindle Store (See Top 100 Paid in Kindle Store)
- #30
in Kindle Store > Kindle eBooks > Computers & Technology > Programming > Python - #77
in Books > Computers & Technology > Programming > Languages & Tools > Python
- #30
in Kindle Store > Kindle eBooks > Computers & Technology > Programming > Python - #77
in Books > Computers & Technology > Programming > Languages & Tools > Python
A few years ago now I was working in a job that required me to code in PERL. My PERL is passable but no better than that so when I found a copy of the PERL cookbook it was something of a life saver and constant companion. The PERL cookbook is deeply pragmatic and addresses real world problems with the language almost as an afterthought. (Which now I think about is actually a pretty good description of PERL anyway!) The Python cookbook is a very different beast and is much more an exercise in learning the intricacies and nuances of the language. I'm not sure cookbook is the right title - if the PERL Cookbook is a cookbook then the Python Cookbook is more of a domestic science textbook. A bit deeper, a bit dryer and not so focused on immediate problems. This is no way meant to imply that it's a bad book, on the contrary it's a very good book just not entirely what I was expecting.
The book itself is divided into fifteen large sections covering the likes of data structures and algorithms; functions; metaprogramming and concurrency with each section consisting of a number of problems. The problems are structured as a definition of the problem, a solution and a discussion of the solution and how it can be extended. Due to the nature of the Python language a large part of solving the problems lies in knowing which module(s) to include in your code so each problem is generally only a couple of pages, but that is certainly enough to give the solution and reasonably detailed discussion. As with all books of this type there is going to be some complaints of why is X included and not Y and to be honest if you tried to cover all the possible problems a practicing python programmer is likely to run across the book would end up so large as to be unusable.
Python Cookbook is an extensive tome of recipes for the Python 3 programmer. It is a perfect companion book for those migrating Python 2 code to Python 3. If you are stuck with Python 2, you may still find the second edition of the book for sale, but the recipes may be dated as they cover Python 2.4. It is not a beginners book. If you are looking for a beginners book, I recommend Learning Python by Mark Lutz.
A quick chapter summary follows.
Chapter 1 has recipes involving manipulation of built-in structures such as dictionaries and sequences. Usage of heapq module for implementing priority queues is demonstrated. Chapter 2 covers string and text manipulation, with extensive use of regular expressions. Chapter 3 has recipes for working with numbers, dates, and times. Usage of numpy module for matrix and linear algebra calculations is demonstrated.
Chapter 4 provides recipes for implementing iterators and generators. Chapter 5 covers File and I/O, including recipes for reading and writing compressed files, memory mapping binary files, and communicating with serial ports. Chapter 6 moves on to more advanced recipes for encoding and processing, such as reading and writing CSV, JSON, XML, Hex digits, and Base64.
Chapter 7 provides recipes for functions and closures. Chapter 8 provides recipes for classes and objects, such as creating managed attributes, lazily computed properties, and extending classes with mixins. It also covers common patterns such as state, and visitor. Chapter 9 digs deeper into metaprogramming. Chapter 10 has recipes for modules and packages, such as for splitting a module into multiple files using packages, and loading modules from another machine using import hooks.
Chapter 11 provides recipes for network and web programming.
Python Cookbook Preview
Link
Please Wait...