Since 2008, the Python world has been looking at the slow development of Python 3. As we all know, Python 3 adoption can take a long time. Even the Python 3 is out, most programmers are still using Python 2 in production. Furthermore, much has been made that Python 3 is not backward compatible with past versions. To be sure, backward compatibility is a problem for anyone with an existing codebase. However, if you look into the future, Python 3 offers more than meets the eye.
Just as Python 3 is about the future, this version of The Python Cookbook represents a major change from past releases. First of all, this is a very forward-looking book. In fact, many recipes only work with Python 3.3 and above. There may be some risk involved, but the ultimate goal is to write a cookbook based on the most modern tools and idioms. Hopefully, these recipes will serve as a guide for anyone writing new code in Python 3 or wanting to modernize existing code.
Needless to say, writing a cookbook in this style presents some challenges for the editor. An online search for Python recipes returns thousands of useful recipes from sites like ActiveState’s Python Recipes or Stack Overflow. However, most recipes are steeped in history and the past. In addition to being written almost exclusively for Python 2, they often contain workarounds and hacks related to differences between older versions of Python(for example, version 2.3 versus 2.4). In addition, they often use has become Python 3.3 built-in features of outdated technology. As a result, finding recipes specifically for Python 3 can be difficult.
Just the theme of the book is inspired by the existing code and technology, rather than trying to find specific to Python 3 recipes. Using these ideas as a springboard, this article is an original work written using the most modern Python programming techniques. As such, it serves as a reference for anyone who wants to write code in a modern style.
In choosing which recipes to include, there was a degree of realization that it would be impossible to write a book that covered everything one could possibly do with Python. Therefore, priority is given to topics that focus on the core Python language and common tasks in various application domains. In addition, many recipes are designed to illustrate new features in Python 3 that even experienced programmers working with older versions may not know about.
There is also a preference for approaches that illustrate universally applicable programming techniques (i.e., programming patterns) instead of approaches that merely attempt to solve very specific practical problems. Finally, most methods focus on the core language and standard libraries, although some third-party packages are also covered.
Data Structures and Algorithms
A variety of useful built-in data structures, such as lists, sets, and dictionaries provided in Python. For the most part, the use of these structures is straightforward. However, common questions concerning searching, sorting, ordering, and filtering often arise. Thus, the goal of this chapter is to discuss common data structures and algorithms involving data. In addition, treatment is given to the various data structures contained in the collections module.
Strings and Text
Resource:
Views: 11