diff Lib/pprint.py @ 10212:e3397ae88129 legacy-trunk

_safe_repr(): Simplify the condition tests in the first possible return path.
author Fred Drake <fdrake@acm.org>
date Wed, 17 Feb 1999 17:30:52 +0000
parents fb4b4d069cc7
children c6bdf032b705
line wrap: on
line diff
--- a/Lib/pprint.py	Wed Feb 17 17:20:50 1999 +0000
+++ b/Lib/pprint.py	Wed Feb 17 17:30:52 1999 +0000
@@ -187,20 +187,15 @@
 
 def _safe_repr(object, context, maxlevels=None, level=0):
     level = level + 1
-    readable = 1
     typ = type(object)
     if not (typ in (DictType, ListType, TupleType) and object):
         rep = `object`
-        if rep:
-            if rep[0] == '<':
-                readable = 0
-        else:
-            readable = 0
-        return `object`, readable
+        return rep, (rep and (rep[0] != '<'))
     if context.has_key(id(object)):
         return `_Recursion(object)`, 0
     objid = id(object)
     context[objid] = 1
+    readable = 1
     if typ is DictType:
         if maxlevels and level >= maxlevels:
             s = "{...}"