Skip to content

Commit e885d71

Browse files
committed
Missed is not None in chapter 8.14 (implementing custom containers)
1 parent 8a71861 commit e885d71

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