Cumbersome array reshaping for broadcasting, unlike numpy

+1 for adding adddims to Base. the accepted solution of indexing with [CartesianIndex()] is not very intuitive.

1 Like

I thought newaxis was super weird and unnatural when I learned it in NumPy. I would probably feel the same if there was a similar magical name in Julia. In contrast I find useful to learn that [CartesianIndex()] works for this: it drives home some aspects of indexing that are hard to grasp otherwise, and more widely useful than this newaxis special case.

So I would prefer to have [CartesianIndex()] documented as a an idomatic example. But I don’t have much need for it, I can imagine people who do want something “nicer”…

1 Like