Catching a traceback
Terry Reedy
tjreedy at udel.edu
Tue Jun 8 08:22:32 EDT 2004
> def write( self, text ):
> self.text += text
With strings, += n times takes O(n**2) time, whereas n appends and join is
O(n). While ok to use when one knows for sure that n will be small, this
strike me as a bad pattern to post publicly, without comment, where new
Pythoneers might get the wrong idea (as evidenced by some past postings
;-). For tracebacks, n is usually definitely small but the occasional n up
to maybe 50 might not be considered so.
Terry J. Reedy
More information about the Python-list
mailing list