import ctypes class array: def __init__(self, size): assert size > 0, array size must be > 0 self._size = size pyarraytype = ctypes.py_object * size self._elements = pyarraytype() self.clear(none) def clear(self, value): for index in range(len(self)): self._elements[index] = value def __len__(self): return self._size def __getitem__(self, index): assert index >= 0 and index =0 and = 0 and index =0 and <= size self._elements[index] = value def __iter__(self): return _arrayiterator(self._elements) class _arrayiterator: def __init__(self, thearray): self._arrayref = thearray self._curndr = 0 def __next__(self): if self._curndr =0 and row =0 and col= 0 and row = 0 and col < len(self.numcols), \ row and col is invalidate thearray = self._therows[row]; thearray[col] = value
希望本文所述对大家的python程序设计有所帮助。
