1. Trang chủ
  2. » Tất cả

Python.Essential.Reference.(2009),.4Ed

745 310 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 745
Dung lượng 4,09 MB

Nội dung

From the Library of Lee Bogdanoff Download at WoweBook.Com Python ESSENTIAL REFERENCE Fourth Edition From the Library of Lee Bogdanoff Download at WoweBook.Com Developer’s Library ESSENTIAL REFERENCES FOR PROGRAMMING PROFESSIONALS Developer’s Library books are designed to provide practicing programmers with unique, high-quality references and tutorials on the programming languages and technologies they use in their daily work All books in the Developer’s Library are written by expert technology practitioners who are especially skilled at organizing and presenting information in a way that’s useful for other programmers Key titles include some of the best, most widely acclaimed books within their topic areas: PHP and MySQL Web Development Python Essential Reference Luke Welling & Laura Thomson ISBN 978-0-672-32916-6 David Beazley ISBN-13: 978-0-672-32862-6 MySQL Programming in Objective-C Paul DuBois ISBN-13: 978-0-672-32938-8 Stephen G Kochan ISBN-13: 978-0-321-56615-7 Linux Kernel Development PostgreSQL Robert Love ISBN-13: 978-0-672-32946-3 Korry Douglas ISBN-13: 978-0-672-33015-5 Developer’s Library books are available at most retail and online bookstores, as well as by subscription from Safari Books Online at safari.informit.com Developer’s Library informit.com/devlibrary From the Library of Lee Bogdanoff Download at WoweBook.Com Python ESSENTIAL REFERENCE Fourth Edition David M Beazley Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Cape Town • Sydney • Tokyo • Singapore • Mexico City From the Library of Lee Bogdanoff Download at WoweBook.Com Acquisitions Editor Mark Taber Python Essential Reference Fourth Edition Copyright © 2009 by Pearson Education, Inc All rights reserved No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher No patent liability is assumed with respect to the use of the information contained herein Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions Nor is any liability assumed for damages resulting from the use of the information contained herein Development Editor Michael Thurston Managing Editor Patrick Kanouse Project Editor Seth Kerney Copy Editor Lisa Thibault ISBN-13: 978-0-672-32978-4 ISBN-10: 0-672-32978-6 Indexer David Beazley Printed in the United States of America Proofreader Megan Wade First Printing June 2009 Library of Congress Cataloging-in-Publication data is on file Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized Addison-Wesley cannot attest to the accuracy of this information Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied The information provided is on an “as is” basis The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book Technical Editors Noah Gift Kurt Grandis Publishing Coordinator Vanessa Evans Book Designer Gary Adair Compositor Bronkella Publishing Bulk Sales Addison-Wesley offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales For more information, please contact U.S Corporate and Government Sales 1-800-382-3419 corpsales@pearsontechgroup.com For sales outside of the U.S., please contact International Sales international@pearson.com To register this product and gain access to bonus content, go to www.informit.com/register to sign in and enter the ISBN After you register the product, a link to the additional content will be listed on your Account page, under Registered Products From the Library of Lee Bogdanoff Download at WoweBook.Com ❖ For Paula,Thomas., and his brother on the way ❖ From the Library of Lee Bogdanoff Download at WoweBook.Com Contents at a Glance Introduction Part I: The Python Language A Tutorial Introduction Lexical Conventions and Syntax Types and Objects 25 33 Operators and Expressions 65 Program Structure and Control Flow 81 Functions and Functional Programming 93 Classes and Object-Oriented Programming Modules, Packages, and Distribution Input and Output 117 143 157 10 Execution Environment 173 11 Testing, Debugging, Profiling, and Tuning 181 Part II: The Python Library 12 Built-In Functions 201 13 Python Runtime Services 14 Mathematics 219 243 15 Data Structures, Algorithms, and Code Simplification 16 String and Text Handling 277 17 Python Database Access 297 18 File and Directory Handling 313 19 Operating System Services 331 20 Threads and Concurrency 413 21 Network Programming and Sockets 22 Internet Application Programming 23 Web Programming 257 449 497 531 24 Internet Data Handling and Encoding 25 Miscellaneous Library Modules 545 585 Part III: Extending and Embedding 26 Extending and Embedding Python Appendix: Python Index 591 621 639 From the Library of Lee Bogdanoff Download at WoweBook.Com Table of Contents Introduction I: The Python Language A Tutorial Introduction Running Python 5 Variables and Arithmetic Expressions Conditionals File Input and Output Strings Lists 10 11 12 Tuples Sets 14 15 Dictionaries 16 Iteration and Looping Functions 17 18 Generators 19 Coroutines 20 Objects and Classes Exceptions Modules 21 22 23 Getting Help 24 Lexical Conventions and Syntax 25 Line Structure and Indentation 25 Identifiers and Reserved Words Numeric Literals String Literals Containers 26 26 27 29 Operators, Delimiters, and Special Symbols Documentation Strings Decorators 30 30 30 Source Code Encoding Types and Objects Terminology 33 31 33 Object Identity and Type 33 Reference Counting and Garbage Collection References and Copies 34 35 From the Library of Lee Bogdanoff Download at WoweBook.Com viii Contents First-Class Objects 36 Built-in Types for Representing Data The None Type 38 Numeric Types 38 Sequence Types 39 Mapping Types Set Types 37 44 46 Built-in Types for Representing Program Structure Callable Types 47 Classes, Types, and Instances Modules 50 50 Built-in Types for Interpreter Internals Code Objects 52 Traceback Objects 52 Generator Objects 53 Slice Objects 51 51 Frame Objects 53 Ellipsis Object 54 Object Behavior and Special Methods Object Creation and Destruction Object String Representation 54 54 55 Object Comparison and Ordering Type Checking 56 57 Attribute Access 57 Attribute Wrapping and Descriptors Sequence and Mapping Methods Iteration 47 58 58 59 Mathematical Operations Callable Interface 60 62 Context Management Protocol Object Inspection and dir() 62 63 Operators and Expressions 65 Operations on Numbers 65 Operations on Sequences String Formatting 67 70 Advanced String Formatting Operations on Dictionaries Operations on Sets 72 74 75 Augmented Assignment 75 From the Library of Lee Bogdanoff Download at WoweBook.Com Contents The Attribute (.) Operator 76 The Function Call () Operator Conversion Functions 76 76 Boolean Expressions and Truth Values Object Equality and Identity Order of Evaluation 77 78 78 Conditional Expressions 79 Program Structure and Control Flow Program Structure and Execution 81 Conditional Execution 81 81 Loops and Iteration Exceptions 82 84 Built-in Exceptions 86 Defining New Exceptions 88 Context Managers and the with Statement Assertions and _ _debug_ _ Parameter Passing and Return Values Scoping Rules 93 95 96 Functions as Objects and Closures 98 101 Generators and yield 102 Coroutines and yield Expressions 104 Using Generators and Coroutines 106 List Comprehensions 108 Generator Expressions 109 Declarative Programming The lambda Operator Recursion 89 91 Functions and Functional Programming Functions 93 Decorators 110 112 112 Documentation Strings Function Attributes 113 114 eval(), exec(), and compile() 115 Classes and Object-Oriented Programming The class Statement 117 Class Instances Scoping Rules Inheritance ix 117 118 118 119 From the Library of Lee Bogdanoff

Ngày đăng: 13/04/2019, 01:45