numpy Hacks

Dummy Module

Default String Printing


In [8]:
%%bash
python
import numpy as np
A = np.round(np.random.randn(5,5)*10);
print(str(A))
np.set_string_function(None)
print(str(A))


[[-10. -10.  21.  -9.   5.]
 [ -9.  -4.  23.   6.   7.]
 [  2.  16.  -8.   5.   2.]
 [  8. -16.   3.  -3.  16.]
 [ -1. -10. -13.   1.  17.]]
[[-10. -10.  21.  -9.   5.]
 [ -9.  -4.  23.   6.   7.]
 [  2.  16.  -8.   5.   2.]
 [  8. -16.   3.  -3.  16.]
 [ -1. -10. -13.   1.  17.]]

In [18]:
%%bash
python

import inspect;

class A(object):
    def __init__(self):
        pass;
    def method(self):
        pass;

print(A.method)
print(A().method)

print(inspect.getsourcefile(A.method))


<function A.method at 0x7f9ba4a22730>
<bound method A.method of <__main__.A object at 0x7f9ba668dd30>>
<stdin>

In [ ]: