Changes between Version 2 and Version 3 of Ticket #3757, comment 1
- Timestamp:
- Feb 20, 2019, 3:15:13 AM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #3757, comment 1
v2 v3 2 2 In Python 3, {{{range()}}} has been removed and {{{xrange()}}} has been renamed to {{{range()}}}. 3 3 4 So any code using {{{xrange()}}} is not Python 3 compatible, so the answer is yes {{{xrange()}}} needs to be replaced by {{{range()}}}. This does lead to bigger RAM usage ({{{range()}}} creates a list while {{{xrange()}}} creates an iterator , although in the vast majority of the cases the impact is negligible (and when it isn't you should probably rethink your algorithms).4 So any code using {{{xrange()}}} is not Python 3 compatible, so the answer is yes {{{xrange()}}} needs to be replaced by {{{range()}}}. This does lead to bigger RAM usage ({{{range()}}} creates a list while {{{xrange()}}} creates an iterator), although in the vast majority of the cases the impact is negligible and when it isn't you should probably rethink your algorithms. 5 5 6 6 The alternative is to introduce a "compatibility layer". E.g.