From 08318a657a683c7d80b06a94aeee3f8f36ffbb25 Mon Sep 17 00:00:00 2001 From: Luciano Ramalho Date: Mon, 17 Jan 2022 15:22:20 -0300 Subject: [PATCH 1/5] harmless edits in .htaccess --- links/FPY.LI.htaccess | 12 ++++++------ links/custom.htaccess | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/links/FPY.LI.htaccess b/links/FPY.LI.htaccess index 9f960f1..6e324d0 100644 --- a/links/FPY.LI.htaccess +++ b/links/FPY.LI.htaccess @@ -1,19 +1,20 @@ ErrorDocument 404 /404.html # main resources +RedirectTemp /book https://www.oreilly.com/library/view/fluent-python-2nd/9781492056348/ RedirectTemp /code https://github.com/fluentpython/example-code-2e RedirectTemp /home https://www.fluentpython.com/ # URLs mentioned at least three times RedirectTemp /bisect https://www.fluentpython.com/extra/ordered-sequences-with-bisect/ -RedirectTemp /cardxvi https://www.python.org/dev/peps/pep-0484/#the-numeric-tower +RedirectTemp /cardxvi https://www.python.org/dev/peps/pep-0484/#the-numeric-tower RedirectTemp /collec https://docs.python.org/3/library/collections.html RedirectTemp /dask https://dask.org/ RedirectTemp /dtmodel https://docs.python.org/3/reference/datamodel.html RedirectTemp /descr101 https://www.python.org/download/releases/2.2.3/descrintro/ RedirectTemp /descrhow https://docs.python.org/3/howto/descriptor.html RedirectTemp /doctest https://docs.python.org/3/library/doctest.html -RedirectTemp /effectpy https://effectivepython.com/ +RedirectTemp /effectpy https://effectivepython.com/ RedirectTemp /fmtspec https://docs.python.org/3/library/string.html#formatspec RedirectTemp /gunicorn https://gunicorn.org/ RedirectTemp /hashint https://www.fluentpython.com/extra/internals-of-sets-and-dicts/ @@ -25,13 +26,12 @@ RedirectTemp /norvigdp http://norvig.com/design-patterns/ RedirectTemp /nsphere https://en.wikipedia.org/wiki/N-sphere RedirectTemp /oldcoro https://www.fluentpython.com/extra/classic-coroutines/ RedirectTemp /pandas https://pandas.pydata.org/ -RedirectTemp /pycook3 https://www.oreilly.com/library/view/python-cookbook-3rd/9781449357337/ -RedirectTemp /pynut3 https://www.oreilly.com/library/view/python-in-a/9781491913833/ +RedirectTemp /pycook3 https://www.oreilly.com/library/view/python-cookbook-3rd/9781449357337/ +RedirectTemp /pynut3 https://www.oreilly.com/library/view/python-in-a/9781491913833/ RedirectTemp /pypydif https://doc.pypy.org/en/latest/cpython_differences.html#subclasses-of-built-in-types RedirectTemp /shed4051 https://github.com/python/typeshed/issues/4051 -RedirectTemp /slatkin https://effectivepython.com/ RedirectTemp /specattr https://docs.python.org/3/library/stdtypes.html#special-attributes -RedirectTemp /typecoro https://docs.python.org/3.10/library/typing.html#typing.Coroutine +RedirectTemp /typecoro https://docs.python.org/3.10/library/typing.html#typing.Coroutine RedirectTemp /typing https://docs.python.org/3/library/typing.html RedirectTemp /weakref https://www.fluentpython.com/extra/weak-references/ diff --git a/links/custom.htaccess b/links/custom.htaccess index b9bc509..a13b9f8 100644 --- a/links/custom.htaccess +++ b/links/custom.htaccess @@ -1,19 +1,20 @@ ErrorDocument 404 /404.html # main resources +RedirectTemp /book https://www.oreilly.com/library/view/fluent-python-2nd/9781492056348/ RedirectTemp /code https://github.com/fluentpython/example-code-2e RedirectTemp /home https://www.fluentpython.com/ # URLs mentioned at least three times RedirectTemp /bisect https://www.fluentpython.com/extra/ordered-sequences-with-bisect/ -RedirectTemp /cardxvi https://www.python.org/dev/peps/pep-0484/#the-numeric-tower +RedirectTemp /cardxvi https://www.python.org/dev/peps/pep-0484/#the-numeric-tower RedirectTemp /collec https://docs.python.org/3/library/collections.html RedirectTemp /dask https://dask.org/ RedirectTemp /dtmodel https://docs.python.org/3/reference/datamodel.html RedirectTemp /descr101 https://www.python.org/download/releases/2.2.3/descrintro/ RedirectTemp /descrhow https://docs.python.org/3/howto/descriptor.html RedirectTemp /doctest https://docs.python.org/3/library/doctest.html -RedirectTemp /effectpy https://effectivepython.com/ +RedirectTemp /effectpy https://effectivepython.com/ RedirectTemp /fmtspec https://docs.python.org/3/library/string.html#formatspec RedirectTemp /gunicorn https://gunicorn.org/ RedirectTemp /hashint https://www.fluentpython.com/extra/internals-of-sets-and-dicts/ @@ -25,13 +26,12 @@ RedirectTemp /norvigdp http://norvig.com/design-patterns/ RedirectTemp /nsphere https://en.wikipedia.org/wiki/N-sphere RedirectTemp /oldcoro https://www.fluentpython.com/extra/classic-coroutines/ RedirectTemp /pandas https://pandas.pydata.org/ -RedirectTemp /pycook3 https://www.oreilly.com/library/view/python-cookbook-3rd/9781449357337/ -RedirectTemp /pynut3 https://www.oreilly.com/library/view/python-in-a/9781491913833/ +RedirectTemp /pycook3 https://www.oreilly.com/library/view/python-cookbook-3rd/9781449357337/ +RedirectTemp /pynut3 https://www.oreilly.com/library/view/python-in-a/9781491913833/ RedirectTemp /pypydif https://doc.pypy.org/en/latest/cpython_differences.html#subclasses-of-built-in-types RedirectTemp /shed4051 https://github.com/python/typeshed/issues/4051 -RedirectTemp /slatkin https://effectivepython.com/ RedirectTemp /specattr https://docs.python.org/3/library/stdtypes.html#special-attributes -RedirectTemp /typecoro https://docs.python.org/3.10/library/typing.html#typing.Coroutine +RedirectTemp /typecoro https://docs.python.org/3.10/library/typing.html#typing.Coroutine RedirectTemp /typing https://docs.python.org/3/library/typing.html RedirectTemp /weakref https://www.fluentpython.com/extra/weak-references/ From b39c1c1f049ec5b0c6e1686cda20b39f45072824 Mon Sep 17 00:00:00 2001 From: Luciano Ramalho Date: Wed, 16 Feb 2022 14:40:49 -0300 Subject: [PATCH 2/5] added bdfl short URL --- links/FPY.LI.htaccess | 3 +++ links/README.md | 5 ++++- links/custom.htaccess | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/links/FPY.LI.htaccess b/links/FPY.LI.htaccess index 6e324d0..d38c973 100644 --- a/links/FPY.LI.htaccess +++ b/links/FPY.LI.htaccess @@ -35,6 +35,9 @@ RedirectTemp /typecoro https://docs.python.org/3.10/library/typing.html#typing.C RedirectTemp /typing https://docs.python.org/3/library/typing.html RedirectTemp /weakref https://www.fluentpython.com/extra/weak-references/ +# URLs added during QA of the Second Edition +RedirectTemp /bdfl https://www.artima.com/weblogs/viewpost.jsp?thread=235725 + # Python Enhancement Proposals RedirectTemp /pep218 https://www.python.org/dev/peps/pep-0218/ RedirectTemp /pep227 https://www.python.org/dev/peps/pep-0227/ diff --git a/links/README.md b/links/README.md index 09c808a..6da595c 100644 --- a/links/README.md +++ b/links/README.md @@ -12,7 +12,10 @@ I replaced almost all URLs in the book with shortened versions that go through t The site has an `.htaccess` file with *temporary* redirects. When I find out a link is stale, I can thange the redirect in `.htaccess` to a new target, -so the link in the book is back in service through the updated redirect. +which may be a link to copy in the Internet Archive's +[Wayback Machine](https://archive.org/web/) +o the link in the book is back in service through the updated redirect. + ## Help wanted diff --git a/links/custom.htaccess b/links/custom.htaccess index a13b9f8..9e070f1 100644 --- a/links/custom.htaccess +++ b/links/custom.htaccess @@ -35,6 +35,9 @@ RedirectTemp /typecoro https://docs.python.org/3.10/library/typing.html#typing.C RedirectTemp /typing https://docs.python.org/3/library/typing.html RedirectTemp /weakref https://www.fluentpython.com/extra/weak-references/ +# URLs added during QA of the Second Edition +RedirectTemp /bdfl https://www.artima.com/weblogs/viewpost.jsp?thread=235725 + # Python Enhancement Proposals RedirectTemp /pep218 https://www.python.org/dev/peps/pep-0218/ RedirectTemp /pep227 https://www.python.org/dev/peps/pep-0227/ From 5f2c3abfc76c906003cb35dbb4e50bd0cb6e0206 Mon Sep 17 00:00:00 2001 From: Luciano Ramalho Date: Wed, 16 Feb 2022 14:46:28 -0300 Subject: [PATCH 3/5] added bdfl short URL --- links/FPY.LI.htaccess | 2 +- links/custom.htaccess | 2 +- links/deploy.sh | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100755 links/deploy.sh diff --git a/links/FPY.LI.htaccess b/links/FPY.LI.htaccess index d38c973..44d2530 100644 --- a/links/FPY.LI.htaccess +++ b/links/FPY.LI.htaccess @@ -35,7 +35,7 @@ RedirectTemp /typecoro https://docs.python.org/3.10/library/typing.html#typing.C RedirectTemp /typing https://docs.python.org/3/library/typing.html RedirectTemp /weakref https://www.fluentpython.com/extra/weak-references/ -# URLs added during QA of the Second Edition +# URL added during QA of the Second Edition RedirectTemp /bdfl https://www.artima.com/weblogs/viewpost.jsp?thread=235725 # Python Enhancement Proposals diff --git a/links/custom.htaccess b/links/custom.htaccess index 9e070f1..ad10802 100644 --- a/links/custom.htaccess +++ b/links/custom.htaccess @@ -35,7 +35,7 @@ RedirectTemp /typecoro https://docs.python.org/3.10/library/typing.html#typing.C RedirectTemp /typing https://docs.python.org/3/library/typing.html RedirectTemp /weakref https://www.fluentpython.com/extra/weak-references/ -# URLs added during QA of the Second Edition +# URL added during QA of the Second Edition RedirectTemp /bdfl https://www.artima.com/weblogs/viewpost.jsp?thread=235725 # Python Enhancement Proposals diff --git a/links/deploy.sh b/links/deploy.sh new file mode 100755 index 0000000..ced9bd9 --- /dev/null +++ b/links/deploy.sh @@ -0,0 +1,2 @@ +#!/bin/bash +scp FPY.LI.htaccess dh_i4p2ka@fpy.li:~/fpy.li/.htaccess From 536e68686fed2c51a29b6dc0e2acbff7aeb3ee3f Mon Sep 17 00:00:00 2001 From: Luciano Ramalho Date: Mon, 21 Feb 2022 18:21:28 -0300 Subject: [PATCH 4/5] updated link to String Format String Syntax in Python 3 --- links/FPY.LI.htaccess | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/links/FPY.LI.htaccess b/links/FPY.LI.htaccess index 44d2530..cc779db 100644 --- a/links/FPY.LI.htaccess +++ b/links/FPY.LI.htaccess @@ -152,7 +152,7 @@ RedirectTemp /a-18 https://www.python.org/doc/essays/ RedirectTemp /1-1 http://hugunin.net/story_of_jython.html RedirectTemp /1-2 https://www.oreilly.com/library/view/jython-essentials/9781449397364/ RedirectTemp /1-3 https://docs.python.org/3/reference/lexical_analysis.html#reserved-classes-of-identifiers -RedirectTemp /1-4 https://docs.python.org/2/library/string.html#format-string-syntax +RedirectTemp /1-4 https://docs.python.org/3.10/library/string.html#format-string-syntax RedirectTemp /1-5 https://stackoverflow.com/questions/1436703/what-is-the-difference-between-str-and-repr RedirectTemp /1-6 https://docs.python.org/3/library/stdtypes.html#truth RedirectTemp /1-7 https://docs.python.org/3/tutorial/controlflow.html#unpacking-argument-lists From a40bd03b0eb9e88884b93377dea7238038893916 Mon Sep 17 00:00:00 2001 From: Luciano Ramalho Date: Wed, 9 Mar 2022 18:35:41 -0300 Subject: [PATCH 5/5] renumbered book parts --- README.md | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 96273ac..234c8da 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,7 @@ # Fluent Python 2e example code -Example code for the book **Fluent Python, 2nd edition** by Luciano Ramalho (O'Reilly, 2021). +Example code for the book **Fluent Python, Second Edition** by Luciano Ramalho (O'Reilly, 2022). -> **BEWARE**: This is a work in progress! -> -> * Code here may change and disappear without warning. -> -> * Major reorganizations may happen at any time. -> -> * No promises. No guarantees. Use at own risk. ## Table of Contents @@ -16,37 +9,37 @@ All chapters are undergoing review and updates, including significant rewrites i New chapters in **Fluent Python 2e** are marked with πŸ†•. -🚨 This table of contents is subject to change at any time until the book goes to the printer. +> 🚨  This table of contents is subject to change at any time until the book goes to the printer.
+Latest change: Old **Part Iβ€”Prologue** merged into new **Part Iβ€”Data Structures**; parts renumbered accordingly; chapter numbers unchanged. Part / Chapter #|Title|Directory|1st ed. Chapter # ---:|---|---|:---: -**I – Prologue**| +**I – Data Structures**| 1|The Python Data Model|[01-data-model](01-data-model)|1 -**II – Data Structures**| 2|An Array of Sequences|[02-array-seq](02-array-seq)|2 3|Dictionaries and Sets|[03-dict-set](03-dict-set)|3 4|Unicode Text versus Bytes|[04-text-byte](04-text-byte)|4 5|Data Class Builders|[05-data-classes](05-data-classes)|πŸ†• 6|Object References, Mutability, and Recycling|[06-obj-ref](06-obj-ref)|8 -**III – Functions as Objects**| +**II – Functions as Objects**| 7|Funcions as First-Class Objects|[07-1class-func](07-1class-func)|5 -8|Type Hints in Function Definitions|[08-def-type-hints](08-def-type-hints)|πŸ†• -9|Function Decorators and Closures|[09-closure-deco](09-closure-deco)|7 +8|Type Hints in Functions|[08-def-type-hints](08-def-type-hints)|πŸ†• +9|Decorators and Closures|[09-closure-deco](09-closure-deco)|7 10|Design Patterns with First-Class Functions|[10-dp-1class-func](10-dp-1class-func)|6 -**IV – Object-Oriented Idioms**| +**III – Object-Oriented Idioms**| 11|A Pythonic Object|[11-pythonic-obj](11-pythonic-obj)|9 -12|Sequence Hacking, Hashing, and Slicing|[12-seq-hacking](12-seq-hacking)|10 +12|Special Methods for Sequences|[12-seq-hacking](12-seq-hacking)|10 13|Interfaces, Protocols, and ABCs|[13-protocl-abc](13-protocol-abc)|11 -14|Inheritance: For Good or For Worse|[14-inheritance](14-inheritance)|12 +14|Inheritance: For Better or For Worse|[14-inheritance](14-inheritance)|12 15|More About Type Hints|[15-more-types](15-more-types)|πŸ†• -16|Operator Overloading: Doing It Right|[16-op-overloading](16-op-overloading)|13 -**V – Control Flow**| +16|Operator Overloading|[16-op-overloading](16-op-overloading)|13 +**IV – Control Flow**| 17|Iterators, Generators, and Classic Coroutines|[17-it-generator](17-it-generator)|14 -18|Context Managers and else Blocks|[18-with-match](18-with-match)|15 +18|with, match, and else Blocks|[18-with-match](18-with-match)|15 19|Concurrency Models in Python|[19-concurrency](19-concurrency)|πŸ†• 20|Concurrent Executors|[20-executors](20-executors)|17 21|Asynchronous Programming|[21-async](21-async)|18 -**VI – Metaprogramming**| +**V – Metaprogramming**| 22|Dynamic Attributes and Properties|[22-dyn-attr-prop](22-dyn-attr-prop)|19 23|Attribute Descriptors|[23-descriptor](23-descriptor)|20 24|Class Metaprogramming|[24-class-metaprog](24-class-metaprog)|21