Skip to content

Commit

Permalink
Merge pull request #29 from l0b0/fix/Sequence
Browse files Browse the repository at this point in the history
fix: Correct reference to `Sequence`
  • Loading branch information
dabeaz authored Jul 25, 2023
2 parents 393db77 + c079eb9 commit 09c35c1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Exercises/ex2_5.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function.

import collections
...
class RideData(collections.Sequence):
class RideData(collections.abc.Sequence):
def __init__(self):
self.routes = [] # Columns
self.dates = []
Expand Down Expand Up @@ -204,7 +204,7 @@ into 4 separate `append()` operations.
# readrides.py
...

class RideData(collections.Sequence):
class RideData(collections.abc.Sequence):
def __init__(self):
# Each value is a list with all of the values (a column)
self.routes = []
Expand Down
2 changes: 1 addition & 1 deletion Exercises/soln2_5.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def read_rides_as_columns(filename):
# The great "fake"

import collections
class RideData(collections.Sequence):
class RideData(collections.abc.Sequence):
def __init__(self):
# Each value is a list with all of the values (a column)
self.routes = []
Expand Down
2 changes: 1 addition & 1 deletion Solutions/2_5/readrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def read_rides_as_columns(filename):
# The great "fake"

import collections
class RideData(collections.Sequence):
class RideData(collections.abc.Sequence):
def __init__(self):
# Each value is a list with all of the values (a column)
self.routes = []
Expand Down
3 changes: 1 addition & 2 deletions Solutions/2_6/colreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import collections
import csv

class DataCollection(collections.Sequence):
class DataCollection(collections.abc.Sequence):
def __init__(self, columns):
self.column_names = list(columns)
self.column_data = list(columns.values())
Expand Down Expand Up @@ -34,4 +34,3 @@ def read_csv_as_columns(filename, types):
tracemalloc.start()
data = read_csv_as_columns('../../Data/ctabus.csv', [intern, intern, intern, int])
print(tracemalloc.get_traced_memory())

0 comments on commit 09c35c1

Please sign in to comment.