[tor-commits] [stem/master] Use the range function instead of xrange

atagar at torproject.org atagar at torproject.org
Sun Nov 6 18:06:43 UTC 2016


commit 5dcf225538e1e54e3365ad78e694595eb9526c76
Author: cypherpunks <cypherpunks at torproject.org>
Date:   Fri Nov 4 10:51:49 2016 +0000

    Use the range function instead of xrange
    
    The xrange function no longer exists in Python 3 [0].
    
    [0] https://docs.python.org/3.0/whatsnew/3.0.html#views-and-iterators-instead-of-lists
---
 docs/_static/example/event_listening.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/docs/_static/example/event_listening.py b/docs/_static/example/event_listening.py
index 2e6f026..ff8c146 100644
--- a/docs/_static/example/event_listening.py
+++ b/docs/_static/example/event_listening.py
@@ -93,15 +93,15 @@ def _render_graph(window, bandwidth_rates):
 
   # draw the graph
 
-  for col in xrange(GRAPH_WIDTH):
+  for col in range(GRAPH_WIDTH):
     col_height = GRAPH_HEIGHT * download_rates[col] / max(max_download_rate, 1)
 
-    for row in xrange(col_height):
+    for row in range(col_height):
       window.addstr(GRAPH_HEIGHT - row, col + 6, " ", DOWNLOAD_COLOR, curses.A_STANDOUT)
 
     col_height = GRAPH_HEIGHT * upload_rates[col] / max(max_upload_rate, 1)
 
-    for row in xrange(col_height):
+    for row in range(col_height):
       window.addstr(GRAPH_HEIGHT - row, col + GRAPH_WIDTH + 12, " ", UPLOAD_COLOR, curses.A_STANDOUT)
 
   window.refresh()





More information about the tor-commits mailing list