天天看點

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,如需轉載請自行聯系原作者