Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 890
Milano Avatar asked Dec 20 '25 23:12

Milano


1 Answers

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 .

like image 138
Alik Avatar answered Dec 23 '25 11:12

Alik