Commit Graph

39 Commits

Author SHA1 Message Date
Ezio Melotti 8dc04a4dd1 Merged revisions 77310-77311 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77310 | antoine.pitrou | 2010-01-05 01:22:44 +0200 (Tue, 05 Jan 2010) | 4 lines

  Issue #7092: Fix the DeprecationWarnings emitted by the standard library
  when using the -3 flag.  Patch by Florent Xicluna.
........
  r77311 | antoine.pitrou | 2010-01-05 01:28:16 +0200 (Tue, 05 Jan 2010) | 3 lines

  Kill a couple of "<>"
........
2010-08-02 00:24:26 +00:00
Facundo Batista 2da91c375b Fixed issue #2888. Now the behaviour of pprint when working with nested
structures follows the common sense (and works like in 2.5 and 3.0).
2008-06-21 17:43:56 +00:00
Georg Brandl 23da6e6545 #1713041: fix pprint's handling of maximum depth. 2008-05-12 16:26:52 +00:00
Raymond Hettinger 5310b69419 Shorter pprint's for empty sets and frozensets. Fix indentation of frozensets. Add tests including two complex data structures. 2008-01-24 21:47:56 +00:00
Raymond Hettinger c226c31139 Let pprint() support sets and frozensets (suggested by David Mertz). 2008-01-23 00:04:40 +00:00
Georg Brandl dcd6b52206 #1351692: in pprint, always call format() for dict and list items to enable
custom formatting of contents via subclassing PrettyPrinter.
2008-01-20 11:13:29 +00:00
Tim Peters d609b1a20e pprint functions used to sort a dict (by key) if and only if
the output required more than one line.  "Small" dicts got
displayed in seemingly random order (the hash-induced order
produced by dict.__repr__).  None of this was documented.
Now pprint functions always sort dicts by key, and the docs
promise it.

This was proposed and agreed to during the PyCon 2006 core
sprint -- I just didn't have time for it before now.
2006-06-02 23:22:51 +00:00
Walter Dörwald e62e936e79 Change PrettyPrinter.pprint(), so that output is written directly to the
output stream, instead of writing it to a StringIO first and writing the
result of this to the output stream. This should speed up the initial
output.
2005-11-11 18:18:51 +00:00
Walter Dörwald 1b626cac73 Fix pprint to be able to handle objects that don't have a __repr__
attribute. Fixes SF bug #1065456.
2004-11-15 13:51:41 +00:00
Skip Montanaro 2dc0c13840 typo - fixes 954030. 2004-05-14 16:31:56 +00:00
Walter Dörwald 70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Walter Dörwald c8de4585a6 Add parameters indent, width and depth to pprint.pprint() and pprint.pformat()
and pass them along to the PrettyPrinter constructor.
2003-12-03 20:26:05 +00:00
Walter Dörwald 7a7ede54d4 Patch #750542: pprint now will pretty print subclasses of list, tuple
and dict too, as long as they don't overwrite __repr__().
2003-12-03 20:15:28 +00:00
Martin v. Löwis d02879d620 Revert 1.25, as overloaded __repr__ is not considered. 2003-06-07 20:47:37 +00:00
Martin v. Löwis e57000338f Patch #750542: Use issubclass instead of type identity. 2003-06-07 20:17:11 +00:00
Fred Drake 397b615056 - PrettyPrinter.isreadable(), .isrecursive():
Pass the right number of args to .format().  (Caught by
    pychecker.)
- Protect the global namespace more carefully.
- Don't use the types module now that we don't need to.
2002-12-31 07:14:18 +00:00
Fred Drake e6691efa0f Change the "__ private" names to "_ protected"; this has been a pain for
subclassing so many times it should simply be changed.
2002-07-08 12:28:06 +00:00
Raymond Hettinger 16e3c427f3 Replace boolean test with is None. 2002-06-01 16:07:16 +00:00
Guido van Rossum 8ca162f417 Partial introduction of bools where appropriate. 2002-04-07 06:36:23 +00:00
Fred Drake aee113d368 Add an experimental mechanism to support extending the pprint formatting.
Partly responds to SF bug #505152.
2002-04-02 05:08:35 +00:00
Barry Warsaw 00859c0538 __format(): Applied SF patch #482003 by Skip to fix multiline dict
output.

Patch includes additional test case test_basic_line_wrap().

This patch is a candidate for Python 2.1.2.
2001-11-28 05:49:39 +00:00
Tim Peters 8876848323 Whitespace normalization. 2001-11-13 21:51:26 +00:00
Fred Drake 49cc01e552 Brute-force performance hackery; buys back about 20% of the time for
saferepr(), a bit less for pformat().
2001-11-01 17:50:38 +00:00
Fred Drake 3e5e661150 Remove obsolete email address. 2001-10-09 20:53:48 +00:00
Fred Drake 1ef106c94d Make pprint more locale-friendly; patch contributed by Denis S. Otkidach.
This closes SF patch #451538.
2001-09-04 19:43:26 +00:00
Tim Peters 95b3f78622 pprint's workhorse _safe_repr() function took time quadratic in the # of
elements when crunching a list, dict or tuple.  Now takes linear time
instead -- huge speedup for even moderately large containers, and the
code is notably simpler too.
Added some basic "is the output correct?" tests to test_pprint.
2001-05-14 18:39:41 +00:00
Tim Peters a814db579d SF bug[ #423781: pprint.isrecursive() broken. 2001-05-14 07:05:58 +00:00
Skip Montanaro c62c81e013 __all__ for several more modules 2001-02-12 02:00:42 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Fred Drake fbff97a73b Don't call len() if the value is already cached! Caught by Gerrit
Holl <gerrit.holl@pobox.com>.
1999-12-22 21:52:32 +00:00
Guido van Rossum 183fd40987 Fix indent error in __format(): del context[objid] at the end should
be executed in all cases, not just when it's not a list, tuple or
dict.  Discovered by Christian Tismer.
1999-09-02 15:09:44 +00:00
Fred Drake d804f4eea0 _safe_repr(): Simplify the condition tests in the first possible
return path.
1999-02-17 17:30:52 +00:00
Guido van Rossum 45e2fbc2e7 Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
Guido van Rossum a1dbe50ec2 Added code to emit trailing ',' for singleton tuples in two places. 1997-09-14 23:21:51 +00:00
Fred Drake e0ffabe375 Slight mods to make the module conform to the documentation. 1997-07-18 20:42:39 +00:00
Fred Drake 5fd026dc5e Fix a couple of glitches identified by Greg Stein. 1997-04-18 13:54:13 +00:00
Fred Drake f39d0516b4 _safe_repr(): Make the context parameter required; ok since it's only for
internal use.  Make sure the maxlevels and level parameters get
	passed to recursive invocations.
1997-04-16 18:55:58 +00:00
Fred Drake a89fda0fe2 Muchly changed and improved pprint.py:
- handles recursive data structures
	- formatting based on a PrettyPrinter object
	- allows a maximum nesting depth to be specified
	- provides safe repr()-like function which does not pretty-print
1997-04-16 16:59:30 +00:00
Guido van Rossum 5e92affc54 Checking in a copy of Fred Drake's data structure pretty-printer
(with some slight formatting changes).

Feature requests:

- Make it a class (everything should be a class);

- support recursive data structures (like pp.py on the ftp contrib site).
1997-04-16 00:49:59 +00:00