I have to write a function that returns a reversed Numpy Array with element type float from a list.
>>>myList = [1, 2, 3, 4, 5]
>>>myList
[1, 2, 3, 4, 5]
I used the reverse() function while passing the list to the numpy.array() function like so:
>>>def arrays(someList):
       return numpy.array(someList.reverse(), float)
But this returns an empty array:
>>>arrays(myList)
array(nan)
However, if I reverse the list using reverse() before passing it, it works alright.
>>>def arrays(someList):
       someList.reverse()
       return numpy.array(someList, float)
>>>arrays(myList)
array([5.,  4.,   3.,   2.,   1.])
On the contrary, if I use the list[::-1] technique to reverse the list in the same place as I had used the reverse() function the first time, it works like a charm.
>>>def arrays(someList):
       return numpy.array(someList[::-1] , float)
>>>arrays(myList)
array([5.,  4.,   3.,   2.,   1.])
Although my code works alright, I want to understand why the first way of using reverse() doesn't work with the numpy.array() function.
Thanks!
Edit 1: Sorry I meant numpy.array(someList.reverse(), float) and not `numpy.array(someList, reverse(), float)
