mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-04 14:54:53 +00:00
Merge pull request #810 from ethereum/fix-build
fix vector to be usable in deepcopy
This commit is contained in:
commit
8b1972e77d
@ -39,15 +39,22 @@ def SSZType(fields):
|
||||
return SSZObject
|
||||
|
||||
|
||||
class Vector(list):
|
||||
def __init__(self, x):
|
||||
list.__init__(self, x)
|
||||
self.length = len(x)
|
||||
class Vector():
|
||||
def __init__(self, items):
|
||||
self.items = items
|
||||
self.length = len(items)
|
||||
|
||||
def append(*args):
|
||||
raise Exception("Cannot change the length of a vector")
|
||||
def __getitem__(self, key):
|
||||
return self.items[key]
|
||||
|
||||
remove = clear = extend = pop = insert = append
|
||||
def __setitem__(self, key, value):
|
||||
self.items[key] = value
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self.items)
|
||||
|
||||
def __len__(self):
|
||||
return self.length
|
||||
|
||||
|
||||
def is_basic(typ):
|
||||
|
Loading…
x
Reference in New Issue
Block a user