Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 00e4741

Browse files
committed
renumbering chapters >= 19
2 parents 4ae4096 + dd535ab commit 00e4741

File tree

113 files changed

+632
-1059
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+632
-1059
lines changed

‎02-array-seq/lispy/README.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,14 @@ The copyright holder is Peter Norvig and the code is licensed under the
2323
[MIT license](https://github.com/norvig/pytudes/blob/60168bce8cdfacf57c92a5b2979f0b2e95367753/LICENSE).
2424

2525

26+
## Changes to Norvig's code
27+
28+
I made small changes to the programs in `original/`:
29+
30+
* In `lis.py`:
31+
* The `Procedure` class accepts a list of expressions as the `body`, and `__call__` evaluates those expressions in order, and returns the value of the last. This is consistent with Scheme's `lambda` syntax and provided a useful example for pattern matching.
32+
* In the `elif` block for `'lambda'`, I added the `*` in front of the `*body` variable in the tuple unpacking to capture the expressions as a list, before calling the `Procedure` constructor.
33+
34+
* In `lispy.py` I made [changes and a pull request](https://github.com/norvig/pytudes/pull/106) to make it run on Python 3.
35+
2636
_Luciano Ramalho<br/>June 29, 2021_

‎04-text-byte/charfinder/README.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Test ``find`` with single result::
5858

5959
Test ``find`` with two results::
6060

61-
>>> find('chess', 'queen', last=0xFFFF) # doctest:+NORMALIZE_WHITESPACE
61+
>>> find('chess', 'queen', end=0xFFFF) # doctest:+NORMALIZE_WHITESPACE
6262
U+2655 ♕ WHITE CHESS QUEEN
6363
U+265B ♛ BLACK CHESS QUEEN
6464

‎04-text-byte/charfinder/cf.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import sys
33
import unicodedata
44

5-
FIRST, LAST = ord(' '), sys.maxunicode # <1>
5+
START, END = ord(' '), sys.maxunicode +1 # <1>
66

7-
def find(*query_words, first=FIRST, last=LAST): # <2>
7+
def find(*query_words, start=START, end=END): # <2>
88
query = {w.upper() for w in query_words} # <3>
9-
for code in range(first, last+1):
9+
for code in range(start, end):
1010
char = chr(code) # <4>
1111
name = unicodedata.name(char, None) # <5>
1212
if name and query.issubset(name.split()): # <6>

‎05-data-classes/dataclass/club.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
from dataclasses import dataclass, field
22

3-
43
@dataclass
54
class ClubMember:
6-
75
name: str
86
guests: list = field(default_factory=list)
97

‎05-data-classes/dataclass/club_wrong.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# tag::CLUBMEMBER[]
44
@dataclass
55
class ClubMember:
6-
76
name: str
87
guests: list = []
98
# end::CLUBMEMBER[]

‎05-data-classes/dataclass/hackerclub.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434

3535
@dataclass
3636
class HackerClubMember(ClubMember): # <1>
37-
3837
all_handles = set() # <2>
39-
4038
handle: str = '' # <3>
4139

4240
def __post_init__(self):

‎05-data-classes/dataclass/hackerclub_annotated.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535

3636
@dataclass
3737
class HackerClubMember(ClubMember):
38-
3938
all_handles: ClassVar[set[str]] = set()
40-
4139
handle: str = ''
4240

4341
def __post_init__(self):

‎05-data-classes/dataclass/resource.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from datetime import date
3333

3434

35-
class ResourceType(Enum): # <1>
35+
class ResourceType(Enum): # <1>
3636
BOOK = auto()
3737
EBOOK = auto()
3838
VIDEO = auto()

‎05-data-classes/meaning/demo_dc.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
@dataclass
44
class DemoDataClass:
5-
65
a: int # <1>
76
b: float = 1.1 # <2>
87
c = 'spam' # <3>

‎05-data-classes/meaning/demo_nt.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import typing
22

33
class DemoNTClass(typing.NamedTuple):
4-
54
a: int # <1>
65
b: float = 1.1 # <2>
76
c = 'spam' # <3>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /