From 1e1d126e4dd41f5dd96bf5102963804ed01d37a3 Mon Sep 17 00:00:00 2001 From: Sameh Abouel-saad Date: Sat, 24 Jul 2021 22:17:44 +0200 Subject: [PATCH 1/2] Update classes.rst the giving example for the generator expressions that yield all words from a page will actually yield all the characters from that page instead, giving that the `page` holds a multiline string. the example could be correct only if the `page` variable contains a list for lines instead, but then the variable name would need to reconsider, ex: `lines`. also the same generator expressions could be simplified to just `unique_words = set(word for word in page.split())` --- Doc/tutorial/classes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index 0d780e3ba89643e..d4115a142bbba28 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -908,7 +908,7 @@ Examples:: >>> sum(x*y for x,y in zip(xvec, yvec)) # dot product 260 - >>> unique_words = set(word for line in page for word in line.split()) + >>> unique_words= set(word for line in page.splitlines() for word in line.split()) >>> valedictorian = max((student.gpa, student.name) for student in graduates) From 336e4c6db301f64fd0d3768cb2f675fc485c718d Mon Sep 17 00:00:00 2001 From: Sameh Abouel-saad Date: Wed, 28 Jul 2021 10:26:24 +0200 Subject: [PATCH 2/2] Removing leading space Co-authored-by: Dominic Davis-Foster --- Doc/tutorial/classes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index d4115a142bbba28..69f644be4e7e6b3 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -908,7 +908,7 @@ Examples:: >>> sum(x*y for x,y in zip(xvec, yvec)) # dot product 260 - >>> unique_words= set(word for line in page.splitlines() for word in line.split()) + >>> unique_words = set(word for line in page.splitlines() for word in line.split()) >>> valedictorian = max((student.gpa, student.name) for student in graduates)