I have the following code
class Row:
__slots__ = ("_values", "_index")
_values: Tuple[int, List[Any]]
_index: Dict[str, int]
def __init__(self, values: Tuple[int, List[Any]], colnames: List[str]):
self._values = values
self._index = {name: i for i, name in enumerate(colnames)}
values: List[Any] = List[Any]()
values.append(1)
values.append(2)
values.append(3)
row = Row((0, values), ["id", "name", "data"])
print(row._index)
if you try to un it, it works, but
This code
class Row:
__slots__ = ("_values", "_index")
_values: Tuple[int, List[Any]]
_index: Dict[str, int]
def __init__(self, values: Tuple[int, List[Any]], colnames: List[str]):
self._values = values
values: List[Any] = List[Any]()
values.append(1)
values.append(2)
values.append(3)
row = Row((0, values), ["id", "name", "data"])
print(row._index)
when self._index is not filled, fails with Segmentation Fault, defining as _index: Dict[str, int] = Dict[str, int]() won't work neither
I have the following code
if you try to un it, it works, but
This code
when self._index is not filled, fails with Segmentation Fault, defining as
_index: Dict[str, int] = Dict[str, int]()won't work neither