From d56f518de1dc38117b0d4013c192e1e34ffebbb1 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Thu, 8 Dec 2022 09:19:58 -0600 Subject: [PATCH 01/11] Fix indentation bug --- Notes/05_Object_model/02_Classes_encapsulation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Notes/05_Object_model/02_Classes_encapsulation.md b/Notes/05_Object_model/02_Classes_encapsulation.md index 77642ec39..11448db77 100644 --- a/Notes/05_Object_model/02_Classes_encapsulation.md +++ b/Notes/05_Object_model/02_Classes_encapsulation.md @@ -95,8 +95,8 @@ One approach: introduce accessor methods. class Stock: def __init__(self, name, shares, price): self.name = name - self.set_shares(shares) - self.price = price + self.set_shares(shares) + self.price = price # Function that layers the "get" operation def get_shares(self): From b7bffbe313315d0aa15dc7bddc9e1b2e83bc96c8 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Sun, 11 Dec 2022 07:19:57 -0600 Subject: [PATCH 02/11] Added a few questions --- README.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5a4db0553..6d22eeb6b 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ pleased to make it available under a Creative Commons license. Enjoy! The material you see here is the heart of an instructor-led Python training course used for corporate training and professional -development. It has been in continual development since 2007 and +development. It was in continual development from 2007 to 2019 and battle tested in real-world classrooms. Usually, it's taught in-person over the span of three or four days--requiring approximately 25-35 hours of intense work. This includes the completion of @@ -36,7 +36,7 @@ doing a bit of Python programming. ## Course Objectives The goal of this course is to cover foundational aspects of Python -programming with an emphasis on script writing, data manipulation, and +programming with an emphasis on script writing, basic data manipulation, and program organization. By the end of this course, students should be able to start writing useful Python programs on their own or be able to understand and modify Python code written by their @@ -57,6 +57,9 @@ This is not a course on web development. That's a different circus. However, if you stick around for this circus, you'll still see some interesting acts--just nothing involving animals. +This is not a course on using tools that happen to be written +in Python. It's about learning the core Python language. + This is not a course for software engineers on how to write or maintain a one-million line Python application. I don't write programs like that, nor do most companies who use Python, and neither should @@ -122,6 +125,17 @@ caused everyone's head to explode or there was never enough time to cover it in the first place. Also, this is a course, not a Python reference manual. +### Q: Why isn't awesome `{command}` in awesome `{tool}` covered? + +The focus of this course is on learning the core Python language, +not learning the names of commands in tools. + +### Q: Is this course being maintained or updated? + +This course represents a "finished product" that was taught and developed +for more than decade. I have no plans to revise the material at this time, but +will occasionally fix bugs and add clarification. + ### Q: Do you accept pull requests? Bug reports are appreciated and may be filed through the From 897e642017627504a6bc9f9012b5c52060077ab0 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Sun, 1 Jan 2023 09:10:56 -0600 Subject: [PATCH 03/11] Added note about API being broken --- Notes/01_Introduction/01_Python.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Notes/01_Introduction/01_Python.md b/Notes/01_Introduction/01_Python.md index e56aeebfa..21f9c4993 100644 --- a/Notes/01_Introduction/01_Python.md +++ b/Notes/01_Introduction/01_Python.md @@ -145,6 +145,11 @@ the class by typing in code slowly and thinking about it--not cut and pasting. ### Exercise 1.4: Where is My Bus? +Note: This was a whimsical example that was a real crowd-pleaser when +I taught this course in my office. You could query the bus and then +literally watch it pass by the window out front. Sadly, APIs rarely live +forever and it seems that this one has now ridden off into the sunset. --Dave + Try something more advanced and type these statements to find out how long people waiting on the corner of Clark street and Balmoral in Chicago will have to wait for the next northbound CTA \#22 bus: From d454b8ec62f007ae6fcf9763ebcd2eb7ca432d54 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Tue, 14 Feb 2023 10:52:00 -0600 Subject: [PATCH 04/11] minor edits --- _layouts/default.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_layouts/default.html b/_layouts/default.html index 157eeb417..81a8c456e 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -41,7 +41,7 @@

A course by David Beazley ( Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
-Copyright (C) 2007-2023, David Beazley. Come take a course. +Copyright (C) 2007-2023, David Beazley. Come take an advanced computer science course. {% if site.github.is_project_page %} Fork me on GitHub {% endif %} From 3c00ff81b7b61eae7ef79a760d60687f9fcf0a81 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Mon, 27 Feb 2023 11:07:22 -0600 Subject: [PATCH 05/11] Added course link --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6d22eeb6b..2392fb3ec 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,15 @@ treatment of Python that has been actively taught to more than 400 in-person groups since 2007. Traders, systems admins, astronomers, tinkerers, and even a few hundred rocket scientists who used Python to help land a rover on Mars--they've all taken this course. Now, I'm -pleased to make it available under a Creative Commons license. Enjoy! +pleased to make it available under a Creative Commons license--completely +free of spam, signups, and other nonsense. Enjoy! [GitHub Pages](https://dabeaz-course.github.io/practical-python) | [GitHub Repo](https://github.com/dabeaz-course/practical-python). ---David Beazley ([https://dabeaz.com](https://dabeaz.com)), [@dabeaz](https://twitter.com/dabeaz) +--David Beazley ([https://dabeaz.com](https://dabeaz.com)), [@dabeaz](https://mastodon.social/@dabeaz) + +(P.S. This course is about Python. If you want a Python course that's about programming, +you might consider [Advanced Programming with Python](https://www.dabeaz.com/advprog.html)) ## What is This? @@ -132,9 +136,10 @@ not learning the names of commands in tools. ### Q: Is this course being maintained or updated? -This course represents a "finished product" that was taught and developed -for more than decade. I have no plans to revise the material at this time, but -will occasionally fix bugs and add clarification. +This course represents a "finished product" that was taught and +developed for more than decade. I have no plans to significantly +revise the material at this time, but will occasionally fix bugs and +add clarification. ### Q: Do you accept pull requests? From c267c45af6f029b362e5c9c828362a3b653b5ecb Mon Sep 17 00:00:00 2001 From: Kevin Reed Date: Tue, 15 Aug 2023 23:44:25 -0500 Subject: [PATCH 06/11] Output correct types in example --- Notes/03_Program_organization/02_More_functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Notes/03_Program_organization/02_More_functions.md b/Notes/03_Program_organization/02_More_functions.md index 579a4b980..2c47872b7 100644 --- a/Notes/03_Program_organization/02_More_functions.md +++ b/Notes/03_Program_organization/02_More_functions.md @@ -501,7 +501,7 @@ For example: ```python >>> portfolio = parse_csv('Data/portfolio.dat', types=[str, int, float], delimiter=' ') >>> portfolio -[{'price': '32.20', 'name': 'AA', 'shares': '100'}, {'price': '91.10', 'name': 'IBM', 'shares': '50'}, {'price': '83.44', 'name': 'CAT', 'shares': '150'}, {'price': '51.23', 'name': 'MSFT', 'shares': '200'}, {'price': '40.37', 'name': 'GE', 'shares': '95'}, {'price': '65.10', 'name': 'MSFT', 'shares': '50'}, {'price': '70.44', 'name': 'IBM', 'shares': '100'}] +[{'name': 'AA', 'shares': 100, 'price': 32.2}, {'name': 'IBM', 'shares': 50, 'price': 91.1}, {'name': 'CAT', 'shares': 150, 'price': 83.44}, {'name': 'MSFT', 'shares': 200, 'price': 51.23}, {'name': 'GE', 'shares': 95, 'price': 40.37}, {'name': 'MSFT', 'shares': 50, 'price': 65.1}, {'name': 'IBM', 'shares': 100, 'price': 70.44}] >>> ``` From 2d3622347704193ff57b5b52c3a62fb6059b4e40 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Mon, 22 Dec 2025 11:36:57 -0600 Subject: [PATCH 07/11] Incorporated issue #157 --- Notes/01_Introduction/01_Python.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Notes/01_Introduction/01_Python.md b/Notes/01_Introduction/01_Python.md index 21f9c4993..44c7302dc 100644 --- a/Notes/01_Introduction/01_Python.md +++ b/Notes/01_Introduction/01_Python.md @@ -150,6 +150,21 @@ I taught this course in my office. You could query the bus and then literally watch it pass by the window out front. Sadly, APIs rarely live forever and it seems that this one has now ridden off into the sunset. --Dave +Update: GitHub user @asett has suggested the following modified code might work, +but you'll have to provide your own API key (available [here](https://www.transitchicago.com/developers/bustracker/)). + +```python +import urllib.request +u = urllib.request.urlopen('http://www.ctabustracker.com/bustime/api/v2/getpredictions?key=ADD_YOUR_API_KEY_HERE&rt=22&stpid=14791') +from xml.etree.ElementTree import parse +doc = parse(u) +print("Arrival time in minutes:") +for pt in doc.findall('.//prdctdn'): + print(pt.text) +``` + +(Original exercise example follows below) + Try something more advanced and type these statements to find out how long people waiting on the corner of Clark street and Balmoral in Chicago will have to wait for the next northbound CTA \#22 bus: From a761bd21e70b5a8b341e6c7bfe7454e1385f6f86 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Mon, 22 Dec 2025 11:39:05 -0600 Subject: [PATCH 08/11] Fixed indentation. Issue #161 --- Notes/01_Introduction/06_Files.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Notes/01_Introduction/06_Files.md b/Notes/01_Introduction/06_Files.md index 8a960f905..bd6d585ca 100644 --- a/Notes/01_Introduction/06_Files.md +++ b/Notes/01_Introduction/06_Files.md @@ -221,8 +221,8 @@ Try it: ```python >>> import gzip >>> with gzip.open('Data/portfolio.csv.gz', 'rt') as f: - for line in f: - print(line, end='') + for line in f: + print(line, end='') ... look at the output ... >>> From 151729ec704049fd09e5cf7e583527ad1b6179a7 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Mon, 22 Dec 2025 11:42:32 -0600 Subject: [PATCH 09/11] Fixed tab issue. Issue #187 --- Notes/04_Classes_objects/02_Inheritance.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Notes/04_Classes_objects/02_Inheritance.md b/Notes/04_Classes_objects/02_Inheritance.md index 13e747d6e..6c8932d81 100644 --- a/Notes/04_Classes_objects/02_Inheritance.md +++ b/Notes/04_Classes_objects/02_Inheritance.md @@ -289,13 +289,13 @@ class TableFormatter: ''' Emit the table headings. ''' - raise NotImplementedError() + raise NotImplementedError() def row(self, rowdata): ''' Emit a single row of table data. ''' - raise NotImplementedError() + raise NotImplementedError() ``` This class does nothing, but it serves as a kind of design specification for From d426db71bc9d435e2628b2d396e6fa35f4a2c123 Mon Sep 17 00:00:00 2001 From: David Beazley Date: Mon, 22 Dec 2025 11:45:00 -0600 Subject: [PATCH 10/11] Fixed Issue #192 --- Notes/02_Working_with_data/02_Containers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Notes/02_Working_with_data/02_Containers.md b/Notes/02_Working_with_data/02_Containers.md index 41833d4aa..68339b840 100644 --- a/Notes/02_Working_with_data/02_Containers.md +++ b/Notes/02_Working_with_data/02_Containers.md @@ -159,7 +159,7 @@ Then to access: >>> ``` -*Neither a list, a set, nor another dictionary can serve as a dictionary key, because lists and dictionaries are mutable.* +*Neither a list, a set, nor another dictionary can serve as a dictionary key, because lists, sets, and dictionaries are mutable.* ### Sets From 93dca856b41c61a0a0f85ae334116e4c125629ea Mon Sep 17 00:00:00 2001 From: David Beazley Date: Mon, 22 Dec 2025 13:51:27 -0600 Subject: [PATCH 11/11] Changed discussion link --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2392fb3ec..00a55e163 100644 --- a/README.md +++ b/README.md @@ -75,9 +75,8 @@ Ok, ok. Point your browser [HERE](Notes/Contents.md)! ## Community Discussion -Want to discuss the course? You can join the conversation on -[Gitter](https://gitter.im/dabeaz-course/practical-python). I can't -promise an individual response, but perhaps others can jump in to help. +Want to discuss the course? Feel free to use [GitHub Discussions](https://github.com/dabeaz-course/practical-python/discussions). +I can't promise an individual response, but perhaps others can jump in to help. ## Acknowledgements