为什么不显示超出范围的指数? [英] Why not just show the out-of-range index?

查看:64
本文介绍了为什么不显示超出范围的指数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个Python程序员偶尔会收到此消息:


IndexError:列表索引超出范围


该消息告诉您错误发生的位置,但它并没有告诉你

范围和违规指数是什么。为什么它会强迫你

为你自己确定这些信息可以为你节省一步

并告诉你?这看起来像是毫无疑问。对我来说。我错过了

的东西吗?

Every Python programmer gets this message occasionally:

IndexError: list index out of range

The message tells you where the error occurred, but it doesn''t tell you
what the range and the offending index are. Why does it force you to
determine that information for yourself when it could save you a step
and just tell you? This seems like a "no-brainer" to me. Am I missing
something?

推荐答案

Russ写道:
Russ wrote:

每个Python程序员偶尔都会得到这个消息:


IndexError:列表索引超出范围


消息告诉你发生错误的地方,但它并没有告诉你

范围和违规指数是什么。为什么它会强迫你

为你自己确定这些信息可以为你节省一步

并告诉你?这看起来像是毫无疑问。对我来说。我错过了

的东西吗?
Every Python programmer gets this message occasionally:

IndexError: list index out of range

The message tells you where the error occurred, but it doesn''t tell you
what the range and the offending index are. Why does it force you to
determine that information for yourself when it could save you a step
and just tell you? This seems like a "no-brainer" to me. Am I missing
something?



我认为你有一点意见。我很想知道人们愿意多远才能捍卫这个遗漏。它有望娱乐。


James


-

James Stroud

加州大学洛杉矶分校基因组学和蛋白质组学研究所

专栏951570

洛杉矶,加利福尼亚州90095

http://www.jamesstroud.com/




James Stroud写道:

James Stroud wrote:

Russ写道:
Russ wrote:

每个Python程序员偶尔会收到此消息:


IndexError:列表索引超出范围


该消息告诉您错误发生的位置,但它没有告诉您

范围和违规索引是什么。为什么它会强迫你

为你自己确定这些信息可以为你节省一步

并告诉你?这看起来像是毫无疑问。对我来说。我错过了什么?b $ b某事?
Every Python programmer gets this message occasionally:

IndexError: list index out of range

The message tells you where the error occurred, but it doesn''t tell you
what the range and the offending index are. Why does it force you to
determine that information for yourself when it could save you a step
and just tell you? This seems like a "no-brainer" to me. Am I missing
something?



我认为你有一点意见。我很想知道人们愿意多远才能捍卫这个遗漏。它有望娱乐。


I think you have a point. I am curious to see how far people are willing
to go to defend this omission. It promises to be entertaining.



添加语法错误:语法无效列表...

Add "Syntax Error: invalid syntax" to the list ...


James Stroud写道:
James Stroud wrote:

Russ写道:
Russ wrote:

>每个Python程序员偶尔会收到此消息:

IndexError:列表索引超出范围

消息告诉你在哪里发生了错误,但它并没有告诉你
范围和违规指数是什么。为什么它会迫使你为自己确定这些信息,因为它可以为你节省一个步骤
并告诉你?这看起来像是毫无疑问。对我来说。我错过了吗?
>Every Python programmer gets this message occasionally:

IndexError: list index out of range

The message tells you where the error occurred, but it doesn''t tell you
what the range and the offending index are. Why does it force you to
determine that information for yourself when it could save you a step
and just tell you? This seems like a "no-brainer" to me. Am I missing
something?



我认为你有一点意见。我很想知道人们愿意多远才能捍卫这个遗漏。它有望娱乐。


I think you have a point. I am curious to see how far people are willing
to go to defend this omission. It promises to be entertaining.



我不确定是否有人会故意将其作为故意遗漏进行辩护。

相反,他们(像我一样)将会鼓励OP提交补丁来解决问题。


-

Robert Kern


"我开始相信整个世界都是一个谜,一个无害的谜团,因为我们疯狂地试图解释它,好像它有一个潜在的基础,这让我觉得很可怕。真相。

- Umberto Eco

I''m not sure that anybody is going to defend it as a deliberate omission.
Rather, they (like I) will encourage to OP to submit a patch that fixes the problem.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco


这篇关于为什么不显示超出范围的指数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆