وبلاگ بلیان

The Quick Python Book, Second Edition

معرفی کتاب «The Quick Python Book, Second Edition» نوشتهٔ Vernon L. Ceder [Ceder, Naomi R.]، منتشرشده توسط نشر Manning Publications Co. LLC در سال 2010. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «The Quick Python Book, Second Edition» در دستهٔ بدون دسته‌بندی قرار دارد.

Vernon Cedar, an experienced teacher of Python at the Canterbury School in Fort Wayne, Indiana and a vociferous proponent of the Python Language has done a superb job of updating an excellent text for the Python 3.0 Language and Programming Environment. Many texts slowly handhold a beginner to establish proficiency in their first programming language, others provide an exhaustive (and EXHAUSTING) reference for all the features of a language definition. This excellent and efficient text provides a rapid path to Python 3.0 proficiency for the programmer who has had exposure to at least one other modern programming language. It gives a rapid overview of the basic language features and programming environment to access its integration with the operating system, graphics libraries, regular expressions and other needed tools, all of this while respecting the needs talents and time limitations of the experienced programmer. It provides the most efficient path to the current version of Python for a Professional Programmer or Experienced Amateur while avoiding unnecessary details and laborious tutorials directed at the neophyte. I would recommend this book highly to anyone who like myself has had exposure to several programming languages and who wishes to rapidly come up to speed with this batteries-included latest programming environment. --Ira Laefsky MSE/MBA IT Consultant Formerly Senior Consultant with Arthur D. Little and DIGITAL Equipment Corporation contents......Page 3 Part 1 Starting out......Page 13 1.1 Why should I use Python?......Page 14 1.2.2 Python is expressive......Page 15 1.2.3 Python is readable......Page 16 1.2.6 Python is free......Page 17 1.3.1 Python is not the fastest language......Page 18 1.4 Why learn Python 3?......Page 19 1.5 Summary......Page 20 2.1 Installing Python......Page 21 2.2.1 The basic interactive mode......Page 23 2.2.2 The IDLE integrated development environment......Page 24 2.3 Using IDLE’s Python Shell window......Page 25 2.5 Using the interactive prompt to explore Python......Page 26 2.6 Summary......Page 28 3 The Quick Python overview......Page 29 3.2.1 Numbers......Page 30 3.2.2 Lists......Page 32 3.2.3 Tuples......Page 33 3.2.4 Strings......Page 34 3.2.6 Sets......Page 35 3.3.1 Boolean values and expressions......Page 36 3.3.3 The while loop......Page 37 3.3.5 Function definition......Page 38 3.3.6 Exceptions......Page 39 3.4 Module creation......Page 40 3.5 Object-oriented programming......Page 41 3.6 Summary......Page 42 Part 2 The essentials......Page 43 4.1 Indentation and block structuring......Page 44 4.3 Variables and assignments......Page 46 4.4 Expressions......Page 47 4.5 Strings......Page 48 4.6 Numbers......Page 49 4.6.4 Complex numbers......Page 50 4.6.5 Advanced complex-number functions......Page 51 4.10 Basic Python style......Page 52 4.11 Summary......Page 53 5 Lists, tuples, and sets......Page 54 5.2 List indices......Page 55 5.3 Modifying lists......Page 57 5.4 Sorting lists......Page 59 5.4.1 Custom sorting......Page 60 5.5.1 List membership with the in operator......Page 61 5.5.5 List search with index......Page 62 5.5.7 Summary of list operations......Page 63 5.6 Nested lists and deep copies......Page 64 5.7.1 Tuple basics......Page 66 5.7.3 Packing and unpacking tuples......Page 67 5.8.1 Set operations......Page 69 5.8.2 Frozensets......Page 70 5.9 Summary......Page 71 6.1 Strings as sequences of characters......Page 72 6.3 Special characters and escape sequences......Page 73 6.3.2 Numeric (octal and hexadecimal) and Unicode escape sequences......Page 74 6.3.3 Printing vs. evaluating strings with special characters......Page 75 6.4.1 The split and join string methods......Page 76 6.4.2 Converting strings to numbers......Page 77 6.4.3 Getting rid of extra whitespace......Page 78 6.4.4 String searching......Page 79 6.4.5 Modifying strings......Page 80 6.4.7 Useful methods and constants......Page 82 6.5 Converting from objects to strings......Page 83 6.6.2 The format method and named parameters......Page 85 6.7 Formatting strings with %......Page 86 6.7.2 Named parameters and formatting sequences......Page 87 6.9 Summary......Page 89 7 Dictionaries......Page 90 7.1 What is a dictionary?......Page 91 7.2 Other dictionary operations......Page 92 7.4 What can be used as a key?......Page 95 7.6 Dictionaries as caches......Page 97 7.8 Summary......Page 98 8.1 The while loop......Page 99 8.2 The if-elif-else statement......Page 100 8.3 The for loop......Page 101 8.3.1 The range function......Page 102 8.3.4 The enumerate function......Page 103 8.4 List and dictionary comprehensions......Page 104 8.5 Statements, blocks, and indentation......Page 105 8.6.1 Most Python objects can be used as Booleans......Page 108 8.6.2 Comparison and Boolean operators......Page 109 8.7 Writing a simple program to analyze a text file......Page 110 8.8 Summary......Page 111 9.1 Basic function definitions......Page 112 9.2.1 Positional parameters......Page 114 9.2.2 Passing arguments by parameter name......Page 115 9.2.3 Variable numbers of arguments......Page 116 9.3 Mutable objects as arguments......Page 117 9.4 Local, nonlocal, and global variables......Page 118 9.6 lambda expressions......Page 120 9.7 Generator functions......Page 121 9.8 Decorators......Page 122 9.9 Summary......Page 123 10.1 What is a module?......Page 124 10.2 A first module......Page 125 10.4 The module search path......Page 128 10.4.1 Where to place your own modules......Page 129 10.5 Private names in modules......Page 130 10.6 Library and third-party modules......Page 131 10.7 Python scoping rules and namespaces......Page 132 10.8 Summary......Page 137 11 Python programs......Page 138 11.1.1 Starting a script from a command line......Page 139 11.1.3 Redirecting the input and output of a script......Page 140 11.1.4 The optparse module......Page 141 11.1.5 Using the fileinput module......Page 142 11.4 Script execution options in Windows......Page 144 11.4.1 Starting a script as a document or shortcut......Page 145 11.4.3 Starting a script from a command window......Page 146 11.5 Scripts on Windows vs. scripts on UNIX......Page 147 11.6 Programs and modules......Page 149 11.7.3 Creating executable programs with freeze......Page 154 11.8 Summary......Page 155 12 Using the filesystem......Page 156 12.1.1 Absolute and relative paths......Page 157 12.1.2 The current working directory......Page 158 12.1.3 Manipulating pathnames......Page 159 12.1.4 Useful constants and functions......Page 162 12.2 Getting information about files......Page 163 12.3 More filesystem operations......Page 164 12.4 Processing all files in a directory subtree......Page 165 12.5 Summary......Page 166 13.1 Opening files and file objects......Page 168 13.3 Opening files in write or other modes......Page 169 13.4 Functions to read and write text or binary data......Page 170 13.5 Screen input/output and redirection......Page 172 13.6 Reading structured binary data with the struct module......Page 174 13.7 Pickling objects into files......Page 176 13.8 Shelving objects......Page 179 13.9 Summary......Page 180 14 Exceptions......Page 181 14.1.1 General philosophy of errors and exception handling......Page 182 14.1.2 A more formal definition of exceptions......Page 184 14.2 Exceptions in Python......Page 185 14.2.1 Types of Python exceptions......Page 186 14.2.2 Raising exceptions......Page 187 14.2.3 Catching and handling exceptions......Page 188 14.2.4 Defining new exceptions......Page 189 14.2.5 Debugging programs with the assert statement......Page 190 14.2.7 Example: a disk-writing program in Python......Page 191 14.2.8 Example: exceptions in normal evaluation......Page 192 14.3 Using with......Page 193 14.4 Summary......Page 194 15 Classes and object-oriented programming......Page 195 15.1.1 Using a class instance as a structure or record......Page 196 15.3 Methods......Page 197 15.4 Class variables......Page 199 15.4.1 An oddity with class variables......Page 200 15.5.1 Static methods......Page 201 15.5.2 Class methods......Page 202 15.6 Inheritance......Page 203 15.7 Inheritance with class and instance variables......Page 205 15.8 Private variables and private methods......Page 206 15.9 Using @property for more flexible instance variables......Page 207 15.10 Scoping rules and namespaces for class instances......Page 208 15.11 Destructors and memory management......Page 212 15.12 Multiple inheritance......Page 216 15.13 Summary......Page 217 16 Graphical user interfaces......Page 218 16.1 Installing Tkinter......Page 219 16.2 Starting Tk and using Tkinter......Page 220 16.3.2 Named attributes......Page 221 16.3.3 Geometry management and widget placement......Page 222 16.4 A simple Tkinter application......Page 223 16.5 Creating widgets......Page 224 16.6 Widget placement......Page 225 16.7 Using classes to manage Tkinter applications......Page 227 16.8 What else can Tkinter do?......Page 228 16.8.1 Event handling......Page 229 16.9 Alternatives to Tkinter......Page 230 16.10 Summary......Page 231 Part 3 Advanced language features......Page 232 17.1 What is a regular expression?......Page 233 17.2 Regular expressions with special characters......Page 234 17.3 Regular expressions and raw strings......Page 235 17.3.1 Raw strings to the rescue......Page 236 17.4 Extracting matched text from strings......Page 237 17.5 Substituting text with regular expressions......Page 240 17.6 Summary......Page 241 18.1 What is a package?......Page 242 18.2 A first example......Page 243 18.3 A concrete example......Page 244 18.3.1 Basic use of the mathproj package......Page 245 18.3.2 Loading subpackages and submodules......Page 246 18.3.4 __init__.py files in packages......Page 247 18.4 The __all__ attribute......Page 248 18.6 Summary......Page 249 19.1 Types are objects, too......Page 250 19.3 Types and user-defined classes......Page 251 19.4 Duck typing......Page 253 19.5 Summary......Page 254 20 Advanced object-oriented features......Page 255 20.1 What is a special method attribute?......Page 256 20.2.1 The __getitem__ special method attribute......Page 257 20.2.2 How it works......Page 258 20.2.3 Implementing full list functionality......Page 259 20.3 Giving an object full list capability......Page 260 20.4.1 Subclassing list......Page 262 20.4.2 Subclassing UserList......Page 263 20.6 Metaclasses......Page 264 20.7 Abstract base classes......Page 266 20.7.1 Using abstract base classes for type checking......Page 267 20.7.3 Using the @abstractmethod and @abstractproperty decorators......Page 268 20.8 Summary......Page 270 Part 4 Where can you go from here?......Page 271 21.1 Why you need to have tests......Page 272 21.2.1 Python’s __debug__ variable......Page 273 21.3 Tests in docstrings: doctests......Page 274 21.3.2 Tweaking doctests with directives......Page 276 21.4.1 Setting up and running a single test case......Page 277 21.4.3 Running multiple tests......Page 279 21.5 Summary......Page 280 22.1 Porting from 2 to 3......Page 281 22.1.1 Steps in porting from Python 2.x to 3.x......Page 282 22.2 Testing with Python 2.6 and -3......Page 283 22.3 Using 2to3 to convert the code......Page 284 22.4 Testing and common problems......Page 286 22.5.1 Using Python 2.5 or earlier......Page 287 22.6 Summary......Page 288 23.1 “Batteries included”—the standard library......Page 289 23.1.1 Managing various data types......Page 290 23.1.2 Manipulating files and storage......Page 291 23.1.3 Accessing operating system services......Page 292 23.1.5 Development and debugging tools and runtime services......Page 293 23.3 Adding more Python libraries......Page 294 23.4.1 Installing under the home scheme......Page 295 23.6 Summary......Page 296 24 Network, web, and database programming......Page 297 24.1.1 Using the sqlite3 database......Page 298 24.2.1 Creating an instant HTTP server......Page 300 24.2.2 Writing an HTTP client......Page 301 24.3.2 Using the wsgi library to create a basic web app......Page 302 24.3.3 Using frameworks to create advanced web apps......Page 303 24.4.1 Creating the database......Page 304 24.4.3 Adding a form and retrieving its contents......Page 305 24.4.4 Saving the form’s contents......Page 306 24.4.5 Parsing the URL and retrieving messages......Page 307 24.4.6 Adding an HTML wrapper......Page 310 24.5 Summary......Page 311 A guide to Python’s documentation......Page 312 The Python manual of style......Page 315 The Zen of Python......Page 328 A......Page 330 C......Page 331 D......Page 332 F......Page 333 H......Page 334 L......Page 335 N......Page 336 P......Page 337 S......Page 339 T......Page 341 W......Page 342 Z......Page 343

The Quick Python Book, Second Edition, is a clear, concise introduction to Python 3, aimed at programmers new to Python. This updated edition includes all the changes in Python 3, itself a significant shift from earlier versions of Python.

The book begins with basic but useful programs that teach the core features of syntax, control flow, and data structures. It then moves to larger applications involving code management, object-oriented programming, web development, and converting code from earlier versions of Python.

True to his audience of experienced developers, the author covers common programming language features concisely, while giving more detail to those features unique to Python.

Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.

The Quick Python Book, Second Edition , is a clear, concise introduction to Python 3, aimed at programmers new to Python. This updated edition includes all the changes in Python 3, itself a significant shift from earlier versions of Python. The book begins with basic but useful programs that teach the core features of syntax, control flow, and data structures. It then moves to larger applications involving code management, object-oriented programming, web development, and converting code from earlier versions of Python. True to his audience of experienced developers, the author covers common programming language features concisely, while giving more detail to those features unique to Python. Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book. "The Quick Python Book, Second Edition, is a clear, concise introduction to Python 3, aimed at programmers new to Python. This updated edition includes all the changes in Python 3, itself a significant shift from earlier versions of Python. The book begins with basic but useful programs that teach the core features of syntax, control flow, and data structures. It then moves to larger applications involving code management, object-oriented programming, web development, and converting code from earlier versions of Python. True to his audience of experienced developers, the author covers common programming language features concisely, while giving more detail to those features unique to Python"--Resource description page "The Quick Python Book, Second Edition, is a clear, concise introduction to Python 3, aimed at programmers new to Python. This updated edition includes all the changes in Python 3, itself a significant shift from earlier versions of Python. The book begins with basic but useful programs that teach the core features of syntax, control flow, and data structures. It then moves to larger applications involving code management, object-oriented programming, web development, and converting code from earlier versions of Python. True to his audience of experienced developers, the author covers common programming language features concisely, while giving more detail to those features unique to Python"--Publisher's description
دانلود کتاب The Quick Python Book, Second Edition