Share E-Book
Scan to open this page

Scan with your phone to open this page

AuthorBill Lubanovic

Easy to understand and fun to read, this updated edition of Introducing Python is ideal for beginning programmers as well as those new to the language. Author Bill Lubanovic takes you from the basics to more involved and varied topics, mixing tutorials with cookbook-style code recipes to explain concepts in Python 3. End-of-chapter exercises help you practice what you've learned. You'll gain a strong foundation in the language, including best practices for testing, debugging, code reuse, and other development tips. This book also shows you how to use Python for applications in business, science, and the arts, using various Python tools and open source packages.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
# Introducing Python: Modern Computing in Simple Packages ## 【One-Line Pitch】 A friendly, hands-on introduction to Python 3 that takes complete beginners from "hello world" to real-world applications in business, science, and the arts, blending tutorials with cookbook-style recipes and end-of-chapter exercises. ## 【Book Arc】 - **Opening (~0%–10%)**: Sets the stage by comparing Python to other languages (shell scripts, C, Java) and explains why Python's readability and simplicity make it a great choice; introduces the basic mechanics of running Python code and the interactive interpreter. - **Early (~10%–25%)**: Covers Python's core data types—numbers, strings, lists, tuples, dictionaries, and sets—with heavy use of interactive examples; emphasizes immutability, indexing, slicing, and the differences between sequence types. - **Early (~25%–35%)**: Moves into control flow, functions, generators, decorators, and exceptions; introduces object-oriented programming with classes, inheritance, and the method resolution order (MRO) for multiple inheritance. - **Middle (~35%–50%)**: Explores Python's standard library and advanced data structures like `deque` and `itertools`; covers Unicode and UTF-8 encoding, regular expressions, and binary file I/O with practical examples like parsing PNG headers. - **Late (~50%–100%)**: Applies everything learned to real-world domains—web development, system administration, data manipulation, and specialized fields like the arts and science; includes testing, debugging, and code reuse best practices (excerpts cover the transition into these application chapters). ## 【Key Takeaways】 - **Python prioritizes readability and developer happiness** (Opening): The language's clean syntax and interactive interpreter make it ideal for beginners, while its power scales to professional projects; the book's tone reflects this philosophy throughout. - **Strings are immutable—work around it deliberately** (Early): You cannot modify a string in place; use `replace()`, slicing, or concatenation instead. Understanding this early prevents a whole class of bugs. - **Lists are flexible, but deletion has multiple flavors** (Early): `del` removes by position, `remove()` deletes by value (first match only), and `pop()` removes and returns an item—each serves a different purpose depending on whether you need the value back. - **Dictionaries and sets are your go-to for fast lookups and uniqueness** (Early): `pop()` with a default argument prevents `KeyError`; set operations like union, intersection, and subset checks (`<=`) are both concise and powerful for comparing collections. - **Generators and decorators are Pythonic superpowers** (Early): Generators (`yield`) produce values lazily, saving memory; decorators wrap functions to add behavior (like logging start/end) without modifying the original code. - **Multiple inheritance follows a predictable order** (Early): Python's MRO (method resolution order) determines which parent class method wins; understanding `ClassName.mro()` helps you reason about complex class hierarchies. - **Unicode and UTF-8 are handled for you—mostly** (Middle): Python stores strings as Unicode internally; you only need to worry about encoding/decoding when exchanging data with the outside world. UTF-8's variable-length design (1–4 bytes) balances space and compatibility. - **Binary file handling is straightforward with the right tools** (Middle): Open files with `'rb'`/`'wb'` modes, use `with` for automatic closing, and leverage `BytesIO` for in-memory byte manipulation—essential for working with images, network protocols, or any non-text data. ## 【Reading Tips】 - **Skim the language comparison chapter** (Opening): If you're new to programming, read it for motivation; if you already know another language, you can skip ahead to the Python-specific content. - **Type along with the interactive examples** (Early): The book is built around `>>>` prompts; reproducing them in your own interpreter is the fastest way to internalize string methods, list operations, and dictionary behavior. - **Do the "Things to Do" exercises at each chapter's end** (Early–Middle): They're short but reinforce exactly what you just learned—like defining a generator that yields odd numbers or writing a decorator that prints start/end. - **Pay extra attention to the MRO and magic methods sections** (Early): These are the trickiest conceptual material; draw the class hierarchy on paper if needed, and test `mro()` yourself to see the order in action. - **Treat the later application chapters as reference material** (Late): Once you've mastered the core language, you can dip into the web, science, or business chapters as needed rather than reading them linearly. ## 【Coverage Limits】 This guide is based on excerpts covering roughly the first half of the book (through binary I/O and Unicode). The later application chapters (web development, data science, system administration) are mentioned but not detailed in the source material. ##
Excerpt 1
specific uses of Python in the arts, science, and business. Python Versus the Language from Planet X How does Python compare against other languages? Where a...
View in text
Excerpt 2
nothing or '+' means right-align, and '-' means left-align. An optional minwidth field width to use. An optional '.' character to separate minwidth and maxch...
View in text
Excerpt 3
ss >>> class Hinny(Horse, Donkey): ... pass If we look for a method or attribute of a Mule, Python will look at the following things, in this order: 1. The o...
View in text
Excerpt 4
ner: length = 13 type = b'IHDR' width = 154 height = 141 >>> print(result.width, result.height) 154, 141 Convert Bytes/Strings with binascii() The standard b...
View in text
Excerpt 5
>> db.set('ducks', 0) True >>> db.get('ducks') 0 >>> db.incr('ducks', 2) 2 >>> db.get('ducks') 2 Redis Redis is a data structure server. It handles keys and...
View in text
Excerpt 6
a2 templating language does a lot more than this. If you’ve programmed in PHP, you’ll see many similarities. Django Django is a very popular Python web frame...
View in text
Excerpt 7
_file = geopandas.datasets.get_path('naturalearth_cities') cities = geopandas.read_file(cities_file) base = world.plot(color='orchid') cities.plot(ax=base, c...
View in text
Excerpt 8
lient.py Starting the client at 2014-06-02 20:28:51.454805 After five seconds, you’ll start getting output in both windows. Here are the first three lines fr...
View in text
Tags
AI categories
PythonProgramming LanguageProgramming
ISBN: 1492051365
Publisher: O'Reilly Media
Publish Year: 2019
Language: English
Pages: 842
File Format: PDF
File Size: 19.7 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…