]> granicus.if.org Git - python/commitdiff
Add provisions to set the (to be documented!) instance variable
authorGuido van Rossum <guido@python.org>
Mon, 7 Oct 1996 21:29:49 +0000 (21:29 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 7 Oct 1996 21:29:49 +0000 (21:29 +0000)
'writer' of the NullFormatter to the writter passed in, or to a
NullWriter if none (or None) is passed in.

Lib/formatter.py

index c192e20ddb567525a77fe1af219237fb33e628ee..79be0f64e35b75cddb5126e9fb5a1ac64515b33c 100644 (file)
@@ -10,7 +10,10 @@ AS_IS = None
 
 class NullFormatter:
 
-    def __init__(self, writer): pass
+    def __init__(self, writer=None):
+       if not writer:
+           writer = NullWriter()
+       self.writer = writer
     def end_paragraph(self, blankline): pass
     def add_line_break(self): pass
     def add_hor_rule(self, abswidth=None, percentwidth=1.0,