-1

I was hanging around with numpy, trying to create an array from a list that I faced something very strange.

list = [range(5), range(5)]
arr1 = np.array(list)

Now, if I say:

list.append(range(5))
arr2 = np.array(list)

everything works fine, however, if I directly say:

arr3 = np.array(list.append(range(5)))

it returns:

array(None, dtype=object)

Anyone knows what the problem is?

Mehdi Jafarnia Jahromi
  • 2,017
  • 3
  • 15
  • 14

1 Answers1

3

list.append doesn't return the list, it just performs the action and returns None.

CrazyCasta
  • 26,917
  • 4
  • 45
  • 72