Master the Powerful Python 3 Standard Library through Real Code Examples The Python 3 Standard Library contains hundreds of modules for interacting with the operating system, interpreter, and Internet--all extensively tested and ready to jump-start application development. Now, Python expert Doug Hellman introduces every major area of the Python 3.x library through concise source code and output examples. Hellman's examples fully demonstrate each feature, and are designed for easy learning and reuse. You'll find practical code for working with text, data structures, algorithms, dates/times, math, the file system, persistence, data exchange, compression, archiving, crypto, processes/threads, networking, Internet capabilities, email, developer and language tools, the runtime, packages, and more. Each section fully covers one module, with links to additional resources, making this book an ideal tutorial and reference. The Python 3 Standard Library by Example introduces Python 3.x's new libraries, significant functionality changes, and new layout and naming conventions. Hellmann also provides expert porting guidance for moving code from 2.x PSL modules to their Python 3.x equivalents. Coverage includes Manipulating text with string, textwrap, re (regular expressions), and difflib Using data structures: enum, collections, array, heapq, queue, struct, copy, and more Implementing algorithms elegantly and concisely with functools, itertools, and contextlib Handling dates/times and advanced mathematical tasks Data exchange and persistence, including json, dbm, and sqlite Archiving and data compression Signing cryptographically and verifying message integrity Managing concurrent operations with processes and threads Using application -building blocks- Testing, debugging, compilation, profiling, language, import, and package tools Controlling interaction at runtime with interpreters or the environment For both new and experienced Python developers, this guide will introduce whole new worlds of functionality and better, more powerful ways to get the job done. Normal 0 false false false EN-US X-NONE X-NONE
“Hellmann’s writing has become an indispensable resource for me and many others as it fills a critical gap in Python Documentation with examples.” — Jesse Noller, Python Core Developer and PSF Board Member Master the Powerful Python Standard Library through Real Code Examples The Python Standard Library contains hundreds of modules for interacting with the operating system, interpreter, and Internet—all extensively tested and ready to jump-start your application development. The Python Standard Library by Example introduces virtually every important area of the Python 2.7 library through concise, stand-alone source code/output examples, designed for easy learning and reuse. Building on his popular Python Module of the Week blog series, author and Python expert Doug Hellmann focuses on “showing” not “telling.” He explains code behavior through downloadable examples that fully demonstrate each feature. You’ll find practical code for working with text, data types, algorithms, math, file systems, networking, the Internet, XML, email, cryptography, concurrency, runtime and language services, and much more. Each section fully covers one module, and links to valuable additional resources, making this book an ideal tutorial and reference. Coverage includes Manipulating text with string, textwrap, re, and difflib Implementing data structures: collections, array, queue, struct, copy, and more Reading, writing, and manipulating files and directories Regular expression pattern matching Exchanging data and providing for persistence Archiving and data compression Managing processes and threads Using application “building blocks”: parsing command-line options, prompting for passwords, scheduling events, and logging Testing, debugging, and compilation Controlling runtime configuration Using module and package utilities If you’re new to Python, this book will quickly give you access to a whole new world of functionality. If you’ve worked with Python before, you’ll discover new, powerful solutions and better ways to use the modules you’ve already tried.
An innovative reference reveals the many capabilites of the Python Standard Library, which is a compilation of commonly used procedures that can be pasted into a Python script, by providing over 300 real-world example scripts. Original. (Intermediate/Advanced)
Python 3 is the best version of the language yet: It is more powerful, convenient, consistent, and expressive than ever before. Now, leading Python programmer Mark Summerfield demonstrates how to write code that takes full advantage of Python 3’s features and idioms. The first book written from a completely “Python 3” viewpoint, Programming in Python 3 brings together all the knowledge you need to write any program, use any standard or third-party Python 3 library, and create new library modules of your own. Summerfield draws on his many years of Python experience to share deep insights into Python 3 development you won’t find anywhere else. He begins by illuminating Python’s “beautiful heart”: the eight key elements of Python you need to write robust, high-performance programs. Building on these core elements, he introduces new topics designed to strengthen your practical expertise—one concept and hands-on example at a time. This book’s coverage includes Developing in Python using procedural, object-oriented, and functional programming paradigms Creating custom packages and modules Writing and reading binary, text, and XML files, including optional compression, random access, and text and XML parsing Leveraging advanced data types, collections, control structures, and functions Spreading program workloads across multiple processes and threads Programming SQL databases and key-value DBM files Utilizing Python’s regular expression mini-language and module Building usable, efficient, GUI-based applications Advanced programming techniques, including generators, function and class decorators, context managers, descriptors, abstract base classes, metaclasses, and more Programming in Python 3 serves as both tutorial and language reference, and it is accompanied by extensive downloadable example code—all of it tested with the final version of Python 3 on Windows, Linux, and Mac OS X.
Introducing modular techniques for building sophisticated programs using Python About This Book The book would help you develop succinct, expressive programs using modular deign The book would explain best practices and common idioms through carefully explained and structured examples It will have broad appeal as far as target audience is concerned and there would be take away for all beginners to Python Who This Book Is For This book is intended for beginner to intermediate level Python programmers who wish to learn how to use modules and packages within their programs. While readers must understand the basics of Python programming, no knowledge of modular programming techniques is required. What You Will Learn Learn how to use modules and packages to organize your Python code Understand how to use the import statement to load modules and packages into your program Use common module patterns such as abstraction and encapsulation to write better programs Discover how to create self-testing Python packages Create reusable modules that other programmers can use Learn how to use GitHub and the Python Package Index to share your code with other people Make use of modules and packages that others have written Use modular techniques to build robust systems that can handle complexity and changing requirements over time In Detail Python has evolved over the years and has become the primary choice of developers in various fields. The purpose of this book is to help readers develop readable, reliable, and maintainable programs in Python. Starting with an introduction to the concept of modules and packages, this book shows how you can use these building blocks to organize a complex program into logical parts and make sure those parts are working correctly together. Using clearly written, real-world examples, this book demonstrates how you can use modular techniques to build better programs. A number of common modular programming patterns are covered, including divide-and-conquer, abstraction, encapsulation, wrappers and extensibility. You will also learn how to test your modules and packages, how to prepare your code for sharing with other people, and how to publish your modules and packages on GitHub and the Python Package Index so that other people can use them. Finally, you will learn how to use modular design techniques to be a more effective programmer. Style and approach This book will be simple and straightforward, focusing on imparting learning through a wide array of examples that the readers can put into use as they read through the book. They should not only be able to understand the way modules help in improving development, but they should also be able to improvise on their techniques of writing concise and effective code.
Create Better Programs Using Concurrency, Libraries, and Patterns
Author: Mark Summerfield
Winner of the 2014 Jolt Award for "Best Book" “Whether you are an experienced programmer or are starting your career, Python in Practice is full of valuable advice and example to help you improve your craft by thinking about problems from different perspectives, introducing tools, and detailing techniques to create more effective solutions.” —Doug Hellmann, Senior Developer, DreamHost If you’re an experienced Python programmer, Python in Practice will help you improve the quality, reliability, speed, maintainability, and usability of all your Python programs. Mark Summerfield focuses on four key themes: design patterns for coding elegance, faster processing through concurrency and compiled Python (Cython), high-level networking, and graphics. He identifies well-proven design patterns that are useful in Python, illuminates them with expert-quality code, and explains why some object-oriented design patterns are irrelevant to Python. He also explodes several counterproductive myths about Python programming—showing, for example, how Python can take full advantage of multicore hardware. All examples, including three complete case studies, have been tested with Python 3.3 (and, where possible, Python 3.2 and 3.1) and crafted to maintain compatibility with future Python 3.x versions. All code has been tested on Linux, and most code has also been tested on OS X and Windows. All code may be downloaded at www.qtrac.eu/pipbook.html. Coverage includes Leveraging Python’s most effective creational, structural, and behavioral design patterns Supporting concurrency with Python’s multiprocessing, threading, and concurrent.futures modules Avoiding concurrency problems using thread-safe queues and futures rather than fragile locks Simplifying networking with high-level modules, including xmlrpclib and RPyC Accelerating Python code with Cython, C-based Python modules, profiling, and other techniques Creating modern-looking GUI applications with Tkinter Leveraging today’s powerful graphics hardware via the OpenGL API using pyglet and PyOpenGL
Python Essential Reference is the definitive reference guide to the Python programming language — the one authoritative handbook that reliably untangles and explains both the core Python language and the most essential parts of the Python library. Designed for the professional programmer, the book is concise, to the point, and highly accessible. It also includes detailed information on the Python library and many advanced subjects that is not available in either the official Python documentation or any other single reference source. Thoroughly updated to reflect the significant new programming language features and library modules that have been introduced in Python 2.6 and Python 3, the fourth edition of Python Essential Reference is the definitive guide for programmers who need to modernize existing Python code or who are planning an eventual migration to Python 3. Programmers starting a new Python project will find detailed coverage of contemporary Python programming idioms. This fourth edition of Python Essential Reference features numerous improvements, additions, and updates: Coverage of new language features, libraries, and modules Practical coverage of Python's more advanced features including generators, coroutines, closures, metaclasses, and decorators Expanded coverage of library modules related to concurrent programming including threads, subprocesses, and the new multiprocessing module Up-to-the-minute coverage of how to use Python 2.6’s forward compatibility mode to evaluate code for Python 3 compatibility Improved organization for even faster answers and better usability Updates to reflect modern Python programming style and idioms Updated and improved example code Deep coverage of low-level system and networking library modules — including options not covered in the standard documentation
Foundations of Python Network Programming, Third Edition, covers all of the classic topics found in the second edition of this book, including network protocols, network data and errors, email, server architecture, and HTTP and web applications, plus updates for Python 3. Some of the new topics in this edition include: • Extensive coverage of the updated SSL support in Python 3 • How to write your own asynchronous I/O loop. • An overview of the "asyncio" framework that comes with Python 3.4. • How the Flask web framework connects URLs to your Python code. • How cross-site scripting and cross-site request forgery can be used to attack your web site, and how to protect against them. • How a full-stack web framework like Django can automate the round trip from your database to the screen and back. If you're a Python programmer who needs a deep understanding of how to use Python for network-related tasks and applications, this is the book for you. From web application developers, to systems integrators, to system administrators—this book has everything that you need to know.