Changes between Version 2 and Version 3 of Ticket #3757, comment 1


Ignore:
Timestamp:
Feb 20, 2019 3:15:13 AM (8 months ago)
Author:
pmav99
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #3757, comment 1

    v2 v3  
    22In Python 3, {{{range()}}} has been removed and {{{xrange()}}} has been renamed to {{{range()}}}.
    33
    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).
     4So 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.
    55
    66The alternative is to introduce a "compatibility layer". E.g.