Closed
Description
I find this example very confusing:
This happens when views are combined with mutating operations. This simple example illustrates that:
x = ones(1) x += 2 y = x # `y` *may* be a view y -= 1 # if `y` is a view, this modifies `x`
The semantics of Python mean that y = x
always makes y
a "view" of x - x is y
by definition.
I think the point this example is trying to make is that "if -=
operates in place, this modifies x
" - but the comments tell a different and incorrect story.
Either that, or the example should include a slice operation of some kind, where the library actually does have an chance to decide whether to make a copy or view.
Metadata
Metadata
Assignees
Labels
No labels