Milano
Milano

Reputation: 18745

Why does not Python specifies errors more deeply?

I'm curious why does not Python specifies errors more deeply? I'm getting this error right now.

firms[i]['predmet_podnikania']=firms[i]['predmet_podnikania'][:-1]+[firms[i]['predmet_podnikania'][-1]+line]
IndexError: list index out of range

Ok, I get that I'm trying to access some list on highest index than the maximum is. But why Python doesn't tell which list is it?

It can be: firms[i] or firms[i]['predmet_podnikania'][-1]

It would save a lot of time.

Upvotes: 3

Views: 58

Answers (1)

Konstantin
Konstantin

Reputation: 25349

This exception is raised in list class. It is not possible to get variable name (firms) inside list methods so the exception contains a generic message .

Upvotes: 4

Related Questions