问题描述
幸运的是我在说不之前尝试过,那是'
而不是in作品:
True
False
有不一致的原因吗?我想
有想过在...中将检查
序列的元素,无论它是什么类型的序列...
-
David C. Ullrich
True
False
有不一致的原因吗?我想
有想过在...中会检查
序列的元素,无论它是什么类型的序列......
----- BEGIN PGP签名-----
版本:GnuPG v1.4.9(MingW32)
评论:将GnuPG与Mozilla一起使用 -
iEYEARECAAYFAkhyiwEACgkQLMI5fndAv9jbiwCeKMXrAclILJ MPro5VuSRgdkvB
cGkAn1igcjFWRQJSwEDOxpk3spzceZGa
= iq8L
----- END PGP SIGNATURE -----
True
False
< URL:http://www.python.org/doc/ref/comparisons.html>
可能。根据该文档,字符串类型的特殊行为在Python中已经改变了
2.3。
-
\ a ??我把隐形眼镜放在我的狗的眼睛里。他们手上的猫只有很少的照片。然后我拿出一个,他在圈子里跑来跑去。
_o__)。 a ?? Steven Wright |
Ben Finney
不一致性比这更深入。例如,索引操作返回的
值的类型:
索引字符串会返回一个字符串(当然长度为1),不会(必然)返回列表。
结论:它们是支持不同操作的不同类型。
给定所有明显的差异(可变性,排序和其他
方法,单个元素的类型),我会说有更多的
差异而不是相似之处,尽管如此序列,他们俩
支持一小部分类似的操作。
加里赫伦
True
False
有不一致的原因吗?我会想到在...中会检查
序列的元素,无论它是什么类型的序列......
----- BEGIN PGP签名-----
版本:GnuPG v1.4.9(MingW32)
评论:将GnuPG与Mozilla一起使用 -
iEYEARECAAYFAkhyiwEACgkQLMI5fndAv9jbiwCeKMXrAclILJ MPro5VuSRgdkvB
cGkAn1igcjFWRQJSwEDOxpk3spzceZGa
= iq8L
-----结束PGP SIGNATURE -----
-
Luckily I tried it before saying no, that''s
not how "in" works:
True
False
Is there a reason for the inconsistency? I would
have thought "in" would check for elements of a
sequence, regardless of what sort of sequence it was...
--
David C. Ullrich
True
False
Is there a reason for the inconsistency? I would
have thought "in" would check for elements of a
sequence, regardless of what sort of sequence it was...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkhyiwEACgkQLMI5fndAv9jbiwCeKMXrAclILJ MPro5VuSRgdkvB
cGkAn1igcjFWRQJSwEDOxpk3spzceZGa
=iq8L
-----END PGP SIGNATURE-----
True
False
<URL:http://www.python.org/doc/ref/comparisons.html>
Probably. The special behaviour of string types was changed in Python
2.3, according to that document.
--
\ a??I put contact lenses in my dog''s eyes. They had little |
`\ pictures of cats on them. Then I took one out and he ran around |
_o__) in circles.a?? a??Steven Wright |
Ben Finney
The inconsistency goes deeper than that. For instance, the type of a
value returned by the indexing operation:
Indexing a string returns a string (of length 1 of course),
while indexing a list does not (necessarily) return a list.
Conclusion: They are different types supporting different operations.
Given all the obvious differences (mutability, sorting and other
methods, types of individual elements), I''d say there are more
differences than similarities, even though, as sequences, they both
support a small subset of similar operations.
Gary Herron
True
False
Is there a reason for the inconsistency? I would
have thought "in" would check for elements of a
sequence, regardless of what sort of sequence it was...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkhyiwEACgkQLMI5fndAv9jbiwCeKMXrAclILJ MPro5VuSRgdkvB
cGkAn1igcjFWRQJSwEDOxpk3spzceZGa
=iq8L
-----END PGP SIGNATURE-----
--
http://mail.python.org/mailman/listinfo/python-list
这篇关于"在"一致性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!