None
allowed because numpy.newaxis
is just an alias for None
.
In [1]: import numpy In [2]: numpy.newaxis is None Out[2]: True
The authors probably chose this because they needed a convenient constant, and None
was available.
Why you should prefer newaxis
over None
: this is mainly because it is more explicit, and partly because someday numpy
authors can change it to something other than None
. (They do not plan and probably will not, but there is no good reason to prefer None
.)
AFoglia Jun 03 '09 at 15:05 2009-06-03 15:05
source share