attribute error
英 /ˈætrɪbjuːt ɪˈrɒː/美 /ˈætrɪbjuːt ɪˈrɑːr/
n. 名词
属性错误;归因错误
词义解析
该词有两层核心含义,均源于“attribute”一词的双重含义:作为动词意为“归因于”,作为名词意为“属性”。其一,在计算机科学中,指访问对象不存在或不适当的属性时引发的错误,如Python中的AttributeError。其二,在逻辑学或心理学中,指将某种性质或行为错误地归因于某人或某物,即归因错误。本义为前者,引申义为后者,从具体的技术错误扩展到抽象的认知偏差。
字源分析
“attribute”源自拉丁语“attribuere”,由“ad-”(向)和“tribuere”(分配)组成,原意为“分配、赋予”。在英语中,作名词时指“属性、特质”,作动词时指“归因于”。“error”源自拉丁语“error”(漫游、错误)。组合后,“attribute error”直译为“属性错误”或“归因错误”。记忆时可拆解为“attribute”(属性/归因)+“error”(错误),表示在属性或归因方面出了问题。
常见语境
在计算机编程领域,常见于技术文档、错误报告和开发者讨论中,指代码运行时的异常,语气中性、专业。在心理学、社会学研究中,用于描述认知偏差,如“基本归因错误”,多见于学术论文。在日常交流中较少使用,若使用则偏向于指代责任归属的失误,略带正式感。在新闻报道中,可能用于分析事件责任,但不如“misattribution”常见。
用法须知
作为名词短语,常作主语或宾语。在编程语境中,通常大写为“AttributeError”,作为专有名词。在学术写作中,常与“make”搭配,如“make an attribute error”。注意“attribute”作动词时重音在第二音节,作名词时重音在第一音节,但在此短语中作名词,读作/ˈætrɪbjuːt/。易错点:不要混淆“attribute error”和“attribution error”,后者专指心理学概念。
同义词区别
“attribute error”在计算机领域与“type error”(类型错误)、“name error”(名称错误)相近,但前者特指属性访问问题,后者分别指类型不匹配和名称未定义。在心理学中,“attribution error”与“fundamental attribution error”(基本归因错误)相近,但前者更宽泛。与“misattribution”(误归因)相比,“attribute error”更强调错误本身,而“misattribution”强调归因过程。在一般语境中,“mistake”和“error”可互换,但“error”更正式。
易错提醒
该词在编程语境中为中性术语,无褒贬色彩。在学术或正式语境中,用“attribution error”而非“attribute error”更准确。常见误用:将“attribute error”误拼为“attribute error”或“attribute error”,注意“attribute”和“error”之间用空格。另外,在非技术语境中,若指“归因错误”,应使用“attribution error”,以免混淆。
高频搭配
- raise an attribute error
- AttributeError: 'module' object has no attribute
- make an attribute error
- correct the attribute error
- attribute error rate
- due to an attribute error
- avoid attribute errors
用法示例
- The program raised an AttributeError because the object has no such attribute.程序引发了属性错误,因为该对象没有这个属性。
- In psychology, the fundamental attribution error explains why we blame others' character for their failures.在心理学中,基本归因错误解释了为什么我们将他人的失败归咎于其性格。
- The error message said 'AttributeError: 'NoneType' object has no attribute 'append'.错误信息显示“属性错误:'NoneType'对象没有‘append’属性”。
- The researcher avoided the attribute error by carefully controlling variables.研究者通过仔细控制变量避免了归因错误。
- When debugging, check for attribute errors before assuming a logic problem.调试时,先检查属性错误,再假设是逻辑问题。