edit, originally i thought this was a problem with passing the class, but then realized it was because when i do val = np.zeros((x,y)) i can not assign a value to val[i] , i found the reason is because although the documentation http://docs.scipy.org/doc/numpy/reference/generated/numpy.zeros.html says >>>
np.zeros((2, 1))
returns
array([[ 0.],
[ 0.]])
but when I do
ara = np.zeros((2,2))
print ara
i get
[[ 0. 0.]
[ 0. 0.]]
which is missing the ',' and makes it impossible to index
I have some class with some initialized values
class myclass():
def __init__(self):
self.stuffone = 0
self.stufftwo = []
then i have some function
def myfunc(stuff):
getstuff = myclass()
getstuff.stuffone = stuff[0]
getstuff.stufftwo = [stuff[1],stuff[0]]
return getstuff
val = np.zeros((1,3))
val[0] = myfunc(stuff)
so I want to call myfunc, pass it some variables, then it should create a class instance and return it to me. What I see so far is that inside of myfunc, i print getstuff and it gives
<__main__.myclass instance at 0x000000000486CC08>
so that makes sense to me, however, when i return getstuff, the value that is returned is just junk, I suppose
[ 1.09268349e-317 1.09268349e-317 1.09268349e-317]
when i return getstuff, the value that is returned is just junk<-- please elaborate this, which is the actual problem.