Graphegon / pygraphblas

GraphBLAS for Python
https://graphegon.github.io/pygraphblas/pygraphblas/index.html
Apache License 2.0
343 stars 27 forks source link

README example `NameError: name 'mod' is not defined` #5

Closed knapply closed 5 years ago

knapply commented 5 years ago

Friendly FYI: I tried the first example without any luck.

>docker run -it pygraphblas/pygraphblas ipython
Python 3.7.4 (default, Jul 13 2019, 14:04:11)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.7.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from pygraphblas import Matrix

In [2]: m = Matrix.from_random(int, 3, 3, 3).apply(lambda x: mod(x, 10))
From cffi callback <function Matrix.apply.<locals>.op_func at 0x7f6a57c7bef0>:
Traceback (most recent call last):
  File "/pygraphblas/pygraphblas/matrix.py", line 513, in op_func
    z[0] = op(x[0])
  File "<ipython-input-18-2d6fe893faad>", line 1, in <lambda>
NameError: name 'mod' is not defined
From cffi callback <function Matrix.apply.<locals>.op_func at 0x7f6a57c7bef0>:
Traceback (most recent call last):
  File "/pygraphblas/pygraphblas/matrix.py", line 513, in op_func
    z[0] = op(x[0])
  File "<ipython-input-18-2d6fe893faad>", line 1, in <lambda>
NameError: name 'mod' is not defined
szarnyasg commented 5 years ago

I have the same issue with a freshly pulled Docker image. @michelp can you take a look at this?

michelp commented 5 years ago

Ah thanks for the issue, what's missing is from operator import mod. I've fixed it in the docs.