Ask Your Question
3

What is the reason for not being able to change a numpy array element using class decorators?

asked 2023-06-14 11:46:40 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-06-14 12:09:02 +0000

ladyg gravatar image

The reason is that numpy arrays are immutable, which means that their elements cannot be modified once they are created. When you try to change an element of a numpy array using a class decorator, you are essentially trying to modify the array itself, which is not allowed. Instead, you need to create a new array with the desired modification.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-14 11:46:40 +0000

Seen: 13 times

Last updated: Jun 14 '23