天天看点

python 反模式

This is not an error but inefficient, since the list search is O(n). If possible, a set or dictionary

should be used instead.

Note: Since the conversion of the list to a set is an O(n) operation, it should ideally be done only once when generating the list.

命名元组可以用于任何正常元组使用的地方,但可以通过name访问value,而不是索引。这使得代码更详细、更容易阅读。

支持解包的序列有:list, tuple, dict

本文转自罗兵博客园博客,原文链接:http://www.cnblogs.com/hhh5460/p/5724530.html,如需转载请自行联系原作者