Should you always favor xrange() over range()?

后端 未结 12 2022
后悔当初
后悔当初 2020-11-22 13:36

Why or why not?

12条回答
  •  长发绾君心
    2020-11-22 14:06

    Go with range for these reasons:

    1) xrange will be going away in newer Python versions. This gives you easy future compatibility.

    2) range will take on the efficiencies associated with xrange.

提交回复
热议问题