分享

python的性能

 java_laq小馆 2013-10-24

python的性能

分类: Python 103人阅读 评论(0) 收藏 举报

1、Use xrange instead of range.

2、"".join(string) is better than + or +=

3、while 1 is faster than while True

4、 list comphrension > for loop > while loop

Use Map, Reduce and Filter instead of for loop where ever possible.

5、for checking 'a in b', dict or set is better than list/tuple.

6、if you need manipulations on both ends of a list, use deque.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多