Skip to content
This repository was archived by the owner on Dec 2, 2021. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions 10-seq-hacking/vector_v5.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -201,7 +201,9 @@
class Vector:
typecode = 'd'

def __init__(self, components):
def __init__(self, components, typecode=None):
if typecode:
self.typecode = typecode
self._components = array(self.typecode, components)

def __iter__(self):
Expand DownExpand Up@@ -284,5 +286,5 @@ def __format__(self, fmt_spec=''):
def frombytes(cls, octets):
typecode = chr(octets[0])
memv = memoryview(octets[1:]).cast(typecode)
return cls(memv)
return cls(memv, typecode)
# END VECTOR_V5