Can't get around "IndexError: list index out of range"
fredrik at pythonware.com
Sun Oct 8 20:44:02 CEST 2006
> With list.has_index() / get(), the following (pretty common I think)
> data = some_unknown_seq
> except IndexError:
> data = None
> if data: ...
umm. you could at least write:
data = some_unknown_seq
... deal with data ...
but "let's hypergeneralize and treat sequences and mappings as the same
thing" proposals are nothing new; a trip to the archives might be help-
More information about the Python-list