Commit de37a9ec authored by Lars Buitinck's avatar Lars Buitinck

some more minor fixes to the buffer docs

parent 52241e8f
...@@ -32,7 +32,7 @@ but rows can be added dynamically. ...@@ -32,7 +32,7 @@ but rows can be added dynamically.
"""Adds a row, initially zero-filled.""" """Adds a row, initially zero-filled."""
self.v.extend(self.ncols) self.v.extend(self.ncols)
There are no members to do anything productive with the matrices' contents. There are no methods to do anything productive with the matrices' contents.
We could implement custom ``__getitem__``, ``__setitem__``, etc. for this, We could implement custom ``__getitem__``, ``__setitem__``, etc. for this,
but instead we'll use the buffer protocol to expose the matrix's data to Python but instead we'll use the buffer protocol to expose the matrix's data to Python
so we can use NumPy to do useful work. so we can use NumPy to do useful work.
...@@ -57,7 +57,7 @@ which Cython handles specially. ...@@ -57,7 +57,7 @@ which Cython handles specially.
def add_row(self): def add_row(self):
"""Adds a row, initially zero-filled.""" """Adds a row, initially zero-filled."""
self.v.resize(self.v.size() + self.ncols) self.v.extend(self.ncols)
def __getbuffer__(self, Py_buffer *buffer, int flags): def __getbuffer__(self, Py_buffer *buffer, int flags):
cdef Py_ssize_t itemsize = sizeof(self.v[0]) cdef Py_ssize_t itemsize = sizeof(self.v[0])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment