[英]Is there some special meaning to `[foo]` right after `from bar import foo` in python? (perhaps python2 specific)
In particular, I am looking at this code: 特别是,我在看这段代码:
import sqlite3
from sqlite3 import IntegrityError
[IntegrityError]
and am wondering: Is there some special meaning to [IntegrityError]
? 并且想知道:
[IntegrityError]
是否有某些特殊含义?
IntegrityError is just a class defined in the sqlite3 package, and of course, my own interpretation is that [IntgrityError]
would just be an expression that puts it in a list, yet there I have it in a piece of code that I am studying. IntegrityError只是sqlite3程序包中定义的一个类,当然,我自己的解释是
[IntgrityError]
只是一个将其放入列表的表达式,但在我正在研究的一段代码中就有了。 Could it be a typo? 可能是拼写错误吗? or am I missing some magic syntactic-sugar interpretation?
还是我缺少一些神奇的语法糖解释?
from sqlite3 import IntegrityError
可以确保系统上已安装from sqlite3 import IntegrityError
DB-API 2.0(PEP-249)版本,并且后续行[IntegrityError]抑制了linter。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.