Skip to content

Commit

Permalink
Merge pull request #22 from Chaniel/master
Browse files Browse the repository at this point in the history
difference between range and xrange
  • Loading branch information
taizilongxu authored Oct 3, 2016
2 parents 4ba5aaa + 35653c5 commit dc81120
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- [27 read,readline和readlines](#27-readreadline和readlines)
- [28 Python2和3的区别](#28-python2和3的区别)
- [29 super.__init__()](#29-super-init)
- [30 range-and-xrange](#30-range-and-xrange)
- [操作系统](#操作系统)
- [1 select,poll和epoll](#1-selectpoll和epoll)
- [2 调度算法](#2-调度算法)
Expand Down Expand Up @@ -667,6 +668,16 @@ Note that the syntax changed in Python 3.0: you can just say super().__init__()

http://stackoverflow.com/questions/576169/understanding-python-super-with-init-methods

## 30 range and xrange
都在循环时使用,xrange内存性能更好。
for i in range(0, 20):
for i in xrange(0, 20):
What is the difference between range and xrange functions in Python 2.X?
range creates a list, so if you do range(1, 10000000) it creates a list in memory with 9999999 elements.
xrange is a sequence object that evaluates lazily.

http://stackoverflow.com/questions/94935/what-is-the-difference-between-range-and-xrange-functions-in-python-2-x

# 操作系统

## 1 select,poll和epoll
Expand Down

0 comments on commit dc81120

Please sign in to comment.