Built in function or method object is not subscriptable

Notice that the error is being thrown when you index M_new. So how is M_new defined? It is by the previous line:

M_new = M.copy

But notice that you’re treated “copy” as if it is an “attribute” of M, but it’s really a “method” which is a function, right? So you’ve assigned M_new to be a reference to the actual function M.copy and not the return value that you would get if you actually invoked by function, which would require parentheses.

2 Likes