tuple
- a = (5) type(a) =
的问题
关于这个问题有相关的讨论。
一个例子是如果(3+4)*3, 结果把括号中当作tuple来看,岂不是(7,7,7),这显然不是我们想要的。
其更直接的解读是
it is the commas, not the parentheses, that define the tuple.
我们做一个测试1
2
31,2, a =
type(a)
<class 'tuple'>
关于这个问题有相关的讨论。
一个例子是如果(3+4)*3, 结果把括号中当作tuple来看,岂不是(7,7,7),这显然不是我们想要的。
其更直接的解读是
it is the commas, not the parentheses, that define the tuple.
我们做一个测试1
2
3>>> a = 1,2,
>>> type(a)
<class 'tuple'>