]> granicus.if.org Git - python/commitdiff
Issue 21469: Minor code modernization (convert and/or expression to an if/else expre...
authorRaymond Hettinger <python@rcn.com>
Tue, 13 May 2014 05:22:46 +0000 (22:22 -0700)
committerRaymond Hettinger <python@rcn.com>
Tue, 13 May 2014 05:22:46 +0000 (22:22 -0700)
Suggested by: Tal Einat

Lib/urllib/robotparser.py

index 1d7b751e0339e079501b403cf8978fbd5c4da2f9..4fbb0cb995ff24878a185cb231855359a872e9d3 100644 (file)
@@ -172,7 +172,7 @@ class RuleLine:
         return self.path == "*" or filename.startswith(self.path)
 
     def __str__(self):
-        return (self.allowance and "Allow" or "Disallow") + ": " + self.path
+        return ("Allow" if self.allowance else "Disallow") + ": " + self.path
 
 
 class Entry: