Skip to content

Commit 2bc135f

Browse files
authored
Merge pull request dabeaz#8 from aliev/chapter-8-14
Missed is not None in chapter 8.14 (implementing custom containers)
2 parents 1f2128f + e885d71 commit 2bc135f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/8/implementing_custom_containers/example1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class SortedItems(collections.Sequence):
77
def __init__(self, initial=None):
8-
self._items = sorted(initial) if initial is None else []
8+
self._items = sorted(initial) if initial is not None else []
99

1010
# Required sequence methods
1111
def __getitem__(self, index):

src/8/implementing_custom_containers/example2.py

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

33
class Items(collections.MutableSequence):
44
def __init__(self, initial=None):
5-
self._items = list(initial) if initial is None else []
5+
self._items = list(initial) if initial is not None else []
66

77
# Required sequence methods
88
def __getitem__(self, index):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy