[tor-commits] [bridgedb/develop] Replace a for loop with a list comprehension

isis at torproject.org isis at torproject.org
Thu Jun 4 08:03:19 UTC 2015


commit 4e3aa2db2d00e7b4abded7038a091f1762483302
Author: Robert Ransom <rransom.8774 at gmail.com>
Date:   Mon Mar 23 11:43:22 2015 -0700

    Replace a for loop with a list comprehension
---
 lib/bridgedb/test/legacy_Tests.py |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/bridgedb/test/legacy_Tests.py b/lib/bridgedb/test/legacy_Tests.py
index bf4cf39..ddf30f3 100644
--- a/lib/bridgedb/test/legacy_Tests.py
+++ b/lib/bridgedb/test/legacy_Tests.py
@@ -80,9 +80,7 @@ def randomPortSpec():
     """
     returns a random list of ports
     """
-    ports = []
-    for i in range(0,24):
-        ports.append(random.randint(1,65535))
+    ports = [randomPort() for i in range(0,24)]
     ports.sort(reverse=True)
 
     portspec = ",".join(["%d" % random.choice(ports) for i in range(0,16)])





More information about the tor-commits mailing list