Dive Into Python 3 (Books for Professionals by Professionals)
معرفی کتاب «Dive Into Python 3 (Books for Professionals by Professionals)» نوشتهٔ Mark Pilgrim، منتشرشده توسط نشر Apress : Imprint : Apress در سال 2009. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
After reading a few reviews on what was the best book to learn python, I decided to try out Dive Into Python 3. I however came to the realization, after my purchase, that buying(as this book can also be downloaded free) was a mistake. Arriving at my door step early in the morning I hurriedly opened the package to "Dive" into it. Firstly, I noticed that the review that stated the book was an exact replica of the PDF version was not joke. The book is littered with many underlined phrases that, on a computer, would surely skip you to a informative webpage or future chapter. No problem, I skip the introduction and go for the meaty bits. The book teaches python like a biology teacher would teach about a frog's organs. It gave me code that is dissected and then explained. So, as the title suggest, I dived strait into Python by typing the "code" into my computer and observing how it works. However, while compiling the first example program, I ran into some issues. A real stynax and string definition nightmare. Something wasn't right, I had installed all the right programs, versions matched up and my code was identical to the book, but there where still issues. So I go online and check the HTML version. Turns out the book is printed without any underscores...... Pros:Heavy Square-ish Will stop a door or make a good paperweight Cons:NO UNDERSCORES?! Source code is useless Continually have to check online version My recommendation would be to download the PDF version and give Mark Pilgrim a donation. a.k.a. “the minus level”......Page 1 Which Python Is Right For You?......Page 3 Installing on Microsoft Windows......Page 4 Installing on Mac OS X......Page 12 Installing on Ubuntu Linux......Page 22 Using The Python Shell......Page 29 Python Editors and IDEs......Page 33 Diving In......Page 34 Declaring Functions......Page 36 Optional and Named Arguments......Page 38 Documentation Strings......Page 40 The import Search Path......Page 41 Everything Is An Object......Page 43 What’s An Object?......Page 44 Indenting Code......Page 45 Exceptions......Page 46 Catching Import Errors......Page 48 Everything is Case-Sensitive......Page 49 Running Scripts......Page 51 Further Reading......Page 52 Diving In......Page 53 Booleans......Page 54 Numbers......Page 55 Coercing Integers To Floats And Vice-Versa......Page 56 Common Numerical Operations......Page 57 Fractions......Page 58 Trigonometry......Page 59 Numbers In A Boolean Context......Page 60 Creating A List......Page 61 Slicing A List......Page 63 Adding Items To A List......Page 64 Searching For Values In A List......Page 66 Removing Items From A List......Page 67 Removing Items From A List: Bonus Round......Page 68 Tuples......Page 70 Tuples In A Boolean Context......Page 73 Assigning Multiple Values At Once......Page 74 Creating A Set......Page 75 Modifying A Set......Page 77 Removing Items From A Set......Page 78 Common Set Operations......Page 80 Sets In A Boolean Context......Page 83 Creating A Dictionary......Page 84 Modifying A Dictionary......Page 85 Mixed-Value Dictionaries......Page 86 None......Page 88 None In A Boolean Context......Page 89 Further Reading......Page 90 The Current Working Directory......Page 91 Working With Filenames and Directory Names......Page 92 Listing Directories......Page 94 Getting File Metadata......Page 96 List Comprehensions......Page 97 Dictionary Comprehensions......Page 99 Other Fun Stuff To Do With Dictionary Comprehensions......Page 101 Further Reading......Page 102 Some Boring Stuff You Need To Understand Before You Can Dive In......Page 104 Unicode......Page 106 Diving In......Page 109 Formatting Strings......Page 110 Compound Field Names......Page 112 Format Specifiers......Page 114 Other Common String Methods......Page 115 Slicing A String......Page 117 Strings vs. Bytes......Page 118 Further Reading......Page 122 Diving In......Page 124 Case Study: Street Addresses......Page 125 Case Study: Roman Numerals......Page 127 Checking For Thousands......Page 128 Checking For Hundreds......Page 130 Using The {n,m} Syntax......Page 132 Checking For Tens And Ones......Page 133 Verbose Regular Expressions......Page 136 Case study: Parsing Phone Numbers......Page 138 Summary......Page 144 Diving In......Page 146 I Know, Let’s Use Regular Expressions!......Page 147 A List Of Functions......Page 150 A List Of Patterns......Page 154 A File Of Patterns......Page 156 Generators......Page 158 A Fibonacci Generator......Page 160 A Plural Rule Generator......Page 161 Further Reading......Page 163 Diving In......Page 164 Defining Classes......Page 165 The __init__() Method......Page 166 Instantiating Classes......Page 167 Instance Variables......Page 168 A Fibonacci Iterator......Page 169 A Plural Rule Iterator......Page 172 Further Reading......Page 179 Diving In......Page 180 Finding all occurrences of a pattern......Page 182 Finding the unique items in a sequence......Page 183 Making assertions......Page 185 Generator expressions......Page 186 Calculating Permutations... The Lazy Way!......Page 187 Other Fun Stuff in the itertools Module......Page 190 A New Kind Of String Manipulation......Page 195 Evaluating Arbitrary Strings As Python Expressions......Page 196 Putting It All Together......Page 202 Further Reading......Page 203 (Not) Diving In......Page 204 A Single Question......Page 206 “Halt And Catch Fire”......Page 214 More Halting, More Fire......Page 219 And One More Thing.........Page 223 A Pleasing Symmetry......Page 227 More Bad Input......Page 233 Diving In......Page 238 Handling Changing Requirements......Page 242 Refactoring......Page 249 Summary......Page 255 Reading From Text Files......Page 256 Character Encoding Rears Its Ugly Head......Page 257 Stream Objects......Page 258 Reading Data From A Text File......Page 259 Closing Files......Page 261 Closing Files Automatically......Page 262 Reading Data One Line At A Time......Page 264 Writing to Text Files......Page 266 Binary Files......Page 267 Streams Objects From Non-File Sources......Page 269 Handling Compressed Files......Page 271 Standard Input, Output, and Error......Page 272 Redirecting Standard Output......Page 274 Further Reading......Page 277 Diving In......Page 278 A 5-Minute Crash Course in XML......Page 281 The Structure Of An Atom Feed......Page 283 Parsing XML......Page 286 Elements Are Lists......Page 287 Attributes Are Dictonaries......Page 288 Searching For Nodes Within An XML Document......Page 289 Going Further With lxml......Page 292 Generating XML......Page 295 Parsing Broken XML......Page 298 Further Reading......Page 301 Diving In......Page 302 Saving Data to a Pickle File......Page 303 Loading Data from a Pickle File......Page 305 Pickling Without a File......Page 307 Bytes and Strings Rear Their Ugly Heads Again......Page 308 Debugging Pickle Files......Page 309 Serializing Python Objects to be Read by Other Languages......Page 312 Saving Data to a JSON File......Page 313 Mapping of Python Datatypes to JSON......Page 315 Serializing Datatypes Unsupported by JSON......Page 316 Loading Data from a JSON File......Page 321 Further Reading......Page 325 Diving In......Page 327 Caching......Page 328 Last-Modified Checking......Page 330 ETags......Page 331 Redirects......Page 333 How Not To Fetch Data Over HTTP......Page 334 What’s On The Wire?......Page 335 Introducing httplib2......Page 339 A Short Digression To Explain Why httplib2 Returns Bytes Instead of Strings......Page 342 How httplib2 Handles Caching......Page 344 How httplib2 Handles Last-Modified and ETag Headers......Page 348 How http2lib Handles Compression......Page 351 How httplib2 Handles Redirects......Page 352 Beyond HTTP GET......Page 357 Beyond HTTP POST......Page 363 Further Reading......Page 365 Diving In......Page 367 Introducing The chardet Module......Page 368 UTF-n With A BOM......Page 369 Multi-Byte Encodings......Page 370 Single-Byte Encodings......Page 371 Running 2to3......Page 372 A Short Digression Into Multi-File Modules......Page 377 False is invalid syntax......Page 379 No module named constants......Page 380 Can’t use a string pattern on a bytes-like object......Page 382 Can't convert 'bytes' object to str implicitly......Page 386 Unsupported operand type(s) for +: 'int' and 'bytes'......Page 389 ord() expected string of length 1, but int found......Page 392 Unorderable types: int() >= str()......Page 394 Global name 'reduce' is not defined......Page 398 Summary......Page 402 Diving In......Page 403 Things Distutils Can’t Do For You......Page 405 Directory Structure......Page 406 Writing Your Setup Script......Page 408 Classifying Your Package......Page 409 Examples of Good Package Classifiers......Page 410 Specifying Additional Files With A Manifest......Page 412 Checking Your Setup Script for Errors......Page 413 Creating a Source Distribution......Page 414 Creating a Graphical Installer......Page 417 Building Installable Packages for Other Operating Systems......Page 419 Adding Your Software to The Python Package Index......Page 420 The Many Possible Futures of Python Packaging......Page 422 Further Reading......Page 423 print statement......Page 424 long data type......Page 425 comparison......Page 426 Dictionary methods that return lists......Page 427 http......Page 428 urllib......Page 429 xmlrpc......Page 430 Other modules......Page 431 Relative imports within a package......Page 432 next() iterator method......Page 433 map() global function......Page 434 apply() global function......Page 435 exec statement......Page 436 repr literals (backticks)......Page 437 try...except statement......Page 438 throw method on generators......Page 439 raw_input() and input() global functions......Page 440 func_* function attributes......Page 441 lambda functions that take a tuple instead of multiple parameters......Page 442 Special method attributes......Page 443 sys.maxint......Page 444 zip() global function......Page 445 types module constants......Page 446 itertools module......Page 447 List comprehensions over tuples......Page 448 Matters of style......Page 449 buffer() global function (explicit)......Page 450 Common idioms (explicit)......Page 451 Basics......Page 453 Computed Attributes......Page 454 Classes That Act Like Functions......Page 458 Classes That Act Like Sequences......Page 460 Classes That Act Like Dictionaries......Page 461 Classes That Act Like Numbers......Page 463 Classes That Can Be Compared......Page 466 Classes That Can Be Serialized......Page 467 Classes That Can Be Used in a with Block......Page 468 Further Reading......Page 470 Things to Read......Page 472 Where To Look For Python 3-Compatible Code......Page 473
دانلود کتاب Dive Into Python 3 (Books for Professionals by Professionals)
Mark Pilgrim's Dive Into Python 3 is a hands-on guide to Python 3 and its differences from Python 2. As in the original book, Dive Into Python, each chapter starts with a real, complete code sample, proceeds to pick it apart and explain the pieces, and then puts it all back together in a summary at the end.
This book includes:
- Example programs completely rewritten to illustrate powerful new concepts now available in Python 3: sets, iterators, generators, closures, comprehensions, and much more
- A detailed case study of porting a major library from Python 2 to Python 3
- A comprehensive appendix of all the syntactic and semantic changes in Python 3
This is the perfect resource for you if you need to port applications to Python 3, or if you like to jump into languages fast and get going right away.
What you’ll learn- To understand Python 3 code by seeing it broken down and explained
- How to make full use of the latest Python features such as iterators, generators, closures, classes and comprehensions
- How to refactor existing code to improve maintainability
- How to serialize Python objects with the pickle protocol and JSON format
- How to package your own Python libraries and upload them to the Python Package Index to share your projects with Python developers worldwide
- How to use Python 3 to consume HTTP web services
- How to port existing Python applications to Python 3 by following a case study for a major library
- Anyone who wants to learn the latest version of Python in a fast, hands-on fashion
- Existing Python programmers who want to learn quickly how to make the most of the features of the latest version of Python and port their code to it
- Programmers coming from other languages wanting a fast introduction to Python that gets them thinking about advanced concepts quickly
- Your First Python Program
- Native Datatypes
- Comprehensions
- Strings
- Regular Expressions
- Closures and Generators
- Classes and Iterators
- Advanced Iterators
- Unit Testing
- Refactoring
- Files
- XML
- Serializing Python Objects
- HTTP Web Services
- Case Study: Porting chardet to Python 3
- Packaging Python Libraries