{"id":16417311,"url":"https://github.com/dabeaz/python-distilled","last_synced_at":"2025-08-01T17:37:22.952Z","repository":{"id":53182122,"uuid":"401082838","full_name":"dabeaz/python-distilled","owner":"dabeaz","description":"Resources for Python Distilled (Book)","archived":false,"fork":false,"pushed_at":"2024-07-24T12:12:11.000Z","size":38,"stargazers_count":100,"open_issues_count":12,"forks_count":17,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-06-21T05:05:33.746Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dabeaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-29T15:58:31.000Z","updated_at":"2025-05-08T20:27:59.000Z","dependencies_parsed_at":"2024-11-18T14:52:26.262Z","dependency_job_id":"9060d5db-cffb-451d-b081-97bef4f2663b","html_url":"https://github.com/dabeaz/python-distilled","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dabeaz/python-distilled","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabeaz%2Fpython-distilled","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabeaz%2Fpython-distilled/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabeaz%2Fpython-distilled/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabeaz%2Fpython-distilled/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dabeaz","download_url":"https://codeload.github.com/dabeaz/python-distilled/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dabeaz%2Fpython-distilled/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268268672,"owners_count":24223104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T07:11:25.948Z","updated_at":"2025-08-01T17:37:22.901Z","avatar_url":"https://github.com/dabeaz.png","language":null,"readme":"# Python Distilled\n\n![](images/cover.jpg)\n\nWelcome!  This repo contains errata related to the [Python\nDistilled](https://www.dabeaz.com/python-distilled) book by [David Beazley](https://www.dabeaz.com).\nIf you'd like to contribute, please submit an issue or pull request.\n\n## Errata\n\n* Table 1.2, pg. 5. Description for `round(a, [n])` should state that it rounds to the nearest multiple of 10 to the -nth power.\n\n* Section 1.6, pg. 10.  Comment in code sample mid-page should read `# g = 'Hello Cruel World'`.\n\n* Table 1.6, pg. 10. Description for `s.endswith(prefix [,start [,end]])` would be better if it used `suffix` instead\nof `prefix`.\n\n* Section 1.8, pg. 15.  `['SYM', '123', '456.78']` should include the newline and be `['SYM', '123', '456.78\\n']`\n\n* Section 1.10, pg. 17-18.  There is somewhat inconsistent use of variable names in this\nsection.  The `names1` variable should be `s` and the `names2` variable should be `t`.\n\n* Section 1.15, pg. 26.  `print \"Going away...\"` should be `print(\"Going away...\")`\n\n* Section 2.1, pg. 38. Typo mid-page should read \"Tuple, list, set, and dictionary literals are written as follows:\"\n\n* Section 2.7, pg. 43.  Truthiness should be expanded to include sets and any non-empty container.  \"... any nonzero number,\na nonempty string, list, tuple, set, dictionary, or container is taken to be true.\"\n\n* Section 2.7, pg. 44.  The function invocation of `foo(3, a)` should be `f(3, a)`.\n\n* Section 2.14, pg. 52. The list comprehension example should use `squares` instead of `nums`.\n\n```python\nnums = [1, 2, 3, 4, 5]\nsquares = [ ]\nfor n in nums:\n    squares.append(n*n)\n```\n\n* Section 2.15, pg. 55. The code example should use slicing `t[:1]` instead of indexing `t[0]`\nto avoid a possible `IndexError` exception.\n\n```\ncomments = (t for t in lines if t[:1] == '#')   # All comments\n```\n\n* Section 4.8, pg. 88.  `compute_cost(prices, quantities)` should be `compute_cost(prices, units)`.\n\n* Section 5.8, pg. 106.  The docstring in the `factorial()` function should use `factorial(5)`\ninstead of `factorial(6)` to get a result of 120.\n\n* Section 5.16, pg. 121.  The first function signature for `after()` should be changed\nto the following:\n\n```\ndef after(seconds, func, /, *args, debug=False, **kwargs):\n    ...\n```\n\n* Section 6.4, pg. 145.   The code for `print_matching()` should be as follows:\n\n```python\ndef print_matching(lines, substring):\n    for line in lines:\n        if substring in line:     # line instead of lines\n\t    print(substring)\n```\n\n* Section 7.1, pg. 153.  An extra line should probably be added to the example to show the effect of mutation:\n\n```\n\u003e\u003e\u003e names[1] = 'Tom'\n\u003e\u003e\u003e names\n[ 'Paula', 'Tom', 'Lewis' ]\n\u003e\u003e\u003e\n```\n\n* Section 7.3, pg. 156.  Missing right parenthesis on `b.withdraw(50.0)`.\n\n* Section 7.7, pg. 160.   Perhaps the class should be called `MyAccount` instead\nof `MyAcount`.   Although, it's inheritance--you can call the class whatever you\nwant!\n\n* Section 7.12, pg. 172. Comment in code right before section 7.13 should read\n`# Calls Date.today(Date)`.\n\n* Section 7.21, pg. 194.  The code for `register_decoder()` should use `mt` instead\nof `mt.mimetype`.  For example:\n\n```python\n_registry = { }\ndef register_decoder(cls):\n    for mt in cls.mimetypes:\n        _registry[mt] = cls\n    return cls\n```\n\n* Section 7.23, pg. 200.   Typo in constructor example at the top.  Should be\n\n```python\na = Account.__new__(Account, 'Guido', 1000.0)\nif isinstance(a, Account):\n    a.__init__('Guido', 1000.0)\n```\n\nThe example that follows should also be corrected to:\n\n```python\na = Account.__new__(Account)\na.__init__('Guido', 1000.0)\n```\n\n* Section 7.23, pg. 200.   Typos in the date `today()` constructor.  Should be\n\n```python\n@classmethod\ndef today(cls):\n    t = time.localtime()\n    self = cls.__new__(cls)    # Make instance\n    self.year = t.tm_year\n    self.month = t.tm_mon\n    self.day = t.tm_mday\n    return self\n```\n\n* Section 7.23, pg. 201.  NOT a typo.  The `__new__()` method of a class is,\nin fact, properly defined as a `@staticmethod` even though it looks like it\nought to be a class method.   This is strange, but you can see this in\nexamples where `__new__()` is invoked directly.  For example, `a = Account.__new__(Account)`\non the previous page. Here, `Account` is passed directly as the `cls` argument as\nwould be required with a `@staticmethod`.\n\n* Section 7.26, pg. 208.  Typo (missing \"that\").  \"A proxy is an object that exposes...\"\n\n* Section 7.28, pg. 212.   `del f.owner` should be `del a.owner` in example.\n\n* Section 8.7, pg. 234.  It should be noted that the `PYTHONPATH` environment variable is a\ncolon-separated list of paths.\n\n* Section 8.14, pg. 241.  Typo (\"is\" should be \"if\"). \"For example, if your package\nlooks like this:\"\n\n* Section 9.3, pg. 250. `format(x, '\u003c*10.2f')` should be `format(x, '*\u003c10.2f')`.\n\n* Section 9.3, pg. 250.  \"The general format of the format specifier should be `[fill][align][sign][0][width][,][.precision][type]` where each part enclosed in `[]` is optional.\"\n\n* Section 9.3, pg, 252. `'Value is {val:\u003c*10.2f}'.format(val=x)` should be `'Value is {val:*\u003c10.2f}'.format(val=x)`.\n\n* Section 9.3, pg, 253. Comment in code sample at bottom third of the page should be changed from `# b'The value is 123.46'` to `# b'Value is 123.46'`.\n\n* Section 9.9, pg. 264. `for filename in path.Path('dirname').glob('*.txt')` should be `for filename in pathlib.Path('dirname').glob('*.txt')`.\n\n* Section 9.15.9, pg. 279.   Typo, missing \"to\" in the sentence \"Go to a directory with a collection of files and type the following:\"\n\n* Section 9.15.12, pg. 281.  Typo in code comment (\"one\" should be \"once\").\n\n```\n# Configuration of logging (occurs once at program startup)\n```\n\n* Section 9.15.15, pg. 283. There is an extra `return pathname.stat().st_size` statement that\ncan be removed (because there is a `return` statement right above it).\n\n* Section 9.15.19, pg. 285.  `serv` should be `server` in the SMTP example:\n\n```python\nserver = smtplib.SMTP('localhost')\nserver.sendmail(fromaddr, toaddrs, msg)\nserver.quit()\n```\n\n* Section 9.15.21, pg. 288.  The output of `struct.pack()` should be as follows:\n\n```\n\u003e\u003e\u003e struct.pack(\"\u003eHIff\", 123, 456, 1.23, 4.56)\nb'\\x00{\\x00\\x00\\x01\\xc8?\\x9dp\\xa4@\\x91\\xeb\\x85'\n\u003e\u003e\u003e\n```\n\n* Section 10.1, pg. 308.  The description of `round()` should start with \"Returns the result of rounding the floating-point number...\"\n\n* Table 10.9, pg. 311.    The description for `format_map()` should use \"taken\" instead of \"taking\".   \"Formats `s` with substitutions taken from the mapping m.\"\n\n* Table 10.10, pg.  The description for `s + t` should read \"Concatenation if `t` is a tuple.\"\n\n* Table 10.10, pg, 313.  The `s.append(x)` method should be deleted.\n\n## Acknowledgements\n\nThe following individuals have contributed errata:\n\n* Jonathan Oberländer\n* Lucas Plaetevoet\n* Chris Gibson\n* Lawrence Wu\n* Andy Lester\n* Siavash Tavakoli\n* Said van de Klundert\n* David Dyck\n* Scythal\n* Feng Guo\n* Xavier Noria\n* Evan Friedenberg\n* Karthik-d-k\n* Marc Hertzog\n* Jack Rubin\n* Paul Barry\n* @physadair\n* @phils4000\n* @michrag\n* Sam Kramer\n* @wildekat\n* Shivam Parke\n* Olivia Nelson\n* @occoder\n* @yatcui\n\n\n","funding_links":[],"categories":["Others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabeaz%2Fpython-distilled","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdabeaz%2Fpython-distilled","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdabeaz%2Fpython-distilled/lists"}