TypeError: unsubscriptable object

Steve Tregidgo smst at bigfoot.com
Thu Jun 8 05:30:16 EDT 2000


Cyrille,

Cyrille Artho wrote:
> 
[code snipped]

# Problem line:
>         P = 1 / (1 + math.exp(-sum))

# Exception raised by attempts to acces P[i]
>                 self.W[i][j] = self.W[i][j]  + n * (
>                     r(S[i] - P[i]) - alpha * (1 - r)
>                     * (S[i] - (1 - P[i]))) * I[j]

There's your problem -- on line 43 you assign a number to
P, which you later try to access as if it were a sequence
object.

Python reports the error (on physical line 74) as being on
line 73, which is how it sees the whole statement.

HTH,
Steve
-- 
Steve Tregidgo
Software Developer
http://www.businesscollaborator.com




More information about the Python-list mailing list