Book description
Portable, powerful, and a breeze to use, Python is ideal for bothstandalone programs and scripting applications. With this hands-onbook, you can master the fundamentals of the core Python languagequickly and efficiently, whether you're new to programming or justnew to Python. Once you finish, you will know enough about thelanguage to use it in any application domain you choose.Learning Python is based on material from author MarkLutz's popular training courses, which he's taught over the pastdecade. Each chapter is a self-contained lesson that helps youthoroughly understand a key component of Python before youcontinue. Along with plenty of annotated examples, illustrations,and chapter summaries, every chapter also contains BrainBuilder, a unique section with practical exercises and reviewquizzes that let you practice new skills and test yourunderstanding as you go.This book covers:
Types and Operations -- Python's major built-in object types indepth: numbers, lists, dictionaries, and more
Statements and Syntax -- the code you type to create andprocess objects in Python, along with Python's general syntaxmodel
Functions -- Python's basic procedural tool for structuring andreusing code
Modules -- packages of statements, functions, and other toolsorganized into larger components
Classes and OOP -- Python's optional object-orientedprogramming tool for structuring code for customization andreuse
Exceptions and Tools -- exception handling model andstatements, plus a look at development tools for writing largerprograms
Learning Python gives you a deep and completeunderstanding of the language that will help you comprehend anyapplication-level examples of Python that you later encounter. Ifyou're ready to discover what Google and YouTube see in Python,this book is the best way to get started.
Table of contents
- Dedication
- A Note Regarding Supplemental Files
- Preface
-
I. Getting Started
- 1. A Python Q&A Session
- 2. How Python Runs Programs
-
3. How You Run Programs
- Interactive Coding
- System Command Lines and Files
- Clicking File Icons
- Module Imports and Reloads
- The IDLE User Interface
- Other IDEs
- Embedding Calls
- Frozen Binary Executables
- Text Editor Launch Options
- Other Launch Options
- Future Possibilities?
- Which Option Should I Use?
- Chapter Summary
- BRAIN BUILDER
-
II. Types and Operations
- 4. Introducing Python Object Types
- 5. Numbers
- 6. The Dynamic Typing Interlude
- 7. ofsmallStrings
- 8. Lists and Dictionaries
- 9. Tuples, Files, and Everything Else
-
III. Statements and Syntax
- 10. Introducing Python Statements
- 11. rwordsAssignment, Expressions, and print
- 12. if Tests
- 13. while and for Loops
- 14. The Documentation Interlude
-
IV. Functions
- 15. Function Basics
- 16. Scopes and Arguments
-
17. Advanced Function Topics
- Anonymous Functions: lambda
- Applying Functions to Arguments
- Mapping Functions over Sequences: map
- Functional Programming Tools: filter and reduce
- List Comprehensions Revisited: Mappings
- Iterators Revisited: Generators
- Timing Iteration Alternatives
- Function Design Concepts
- Function Gotchas
- Chapter Summary
- BRAIN BUILDER
-
V. Modules
- 18. Modules: The Big Picture
- 19. Module Coding Basics
- 20. Module Packages
- 21. Advanced Module Topics
-
VI. Classes and OOP
- 22. OOP: The Big Picture
- 23. Class Coding Basics
-
24. Class Coding Details
- The class Statement
- Methods
- Inheritance
-
Operator Overloading
- Common Operator Overloading Methods
- _ _getitem_ _ Intercepts Index References
- _ _getitem_ _ and _ _iter_ _ Implement Iteration
- User-Defined Iterators
- _ _getattr_ _ and _ _setattr_ _ Catch Attribute References
- Emulating Privacy for Instance Attributes
- _ _repr_ _ and _ _str_ _ Return String Representations
- _ _radd_ _ Handles Right-Side Addition
- _ _call_ _ Intercepts Calls
- Function Interfaces and Callback-Based Code
- _ _del_ _ Is a Destructor
- Namespaces: The Whole Story
- A More Realistic Example
- Chapter Summary
-
25. Designing with Classes
- Python and OOP
- Classes As Records
- OOP and Inheritance: “Is-a” Relationships
- OOP and Composition: “Has-a” Relationships
- OOP and Delegation
- Multiple Inheritance
- Classes Are Objects: Generic Object Factories
- Methods Are Objects: Bound or Unbound
- Documentation Strings Revisited
- Classes Versus Modules
- Chapter Summary
- 26. Advanced Class Topics
-
VII. Exceptions and Tools
- 27. Exception Basics
- 28. Exception Objects
- 29. Designing with Exceptions
- VIII. Appendixes
- About the Author
- Colophon
- Copyright
Product information
- Title: Learning Python, 3rd Edition
- Author(s):
- Release date: October 2007
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9780596513986
You might also like
book
Designing Large Language Model Applications
Transformer-based language models are powerful tools for solving a variety of language tasks and represent a …
book
Fluent Python, 2nd Edition
Don't waste time bending Python to fit patterns you've learned in other languages. Python's simplicity lets …
book
Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 3rd Edition
Through a recent series of breakthroughs, deep learning has boosted the entire field of machine learning. …
book
SQL for Data Analysis
With the explosion of data, computing power, and cloud data warehouses, SQL has become an even …