Cumbersome array reshaping for broadcasting, unlike numpy

I use the following definition

na = [CartesianIndex()]  # for "newaxis"
arr = rand(10,10)
arr[:,na,:,na] # is 10×1×10×1

However, I find I need this in Julia much less than in numpy, thanks to array comprehension.
Still, I think this is worth having in Base, since using [CatesianIndex()] is not very intuitive.

20 Likes