[issue7434] pprint doesn't know how to print a namedtuple

2010-02-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: Will ponder this a bit more but will likely close this specific request (leaving open the possibility of a more general rewrite of pprint). -- assignee: -> rhettinger priority: -> low versions: +Python 2.7, Python 3.2 -Python 2.6

[issue7434] pprint doesn't know how to print a namedtuple

2009-12-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: We need a more generic solution that allows multi-line reprs for a variety of types. Here is an example that doesn't involve named tuples: >>> pprint(s, width=15) [OrderedDict([('x', 300), ('y', 40), ('z', 50)]), OrderedDict([('x',

[issue7434] pprint doesn't know how to print a namedtuple

2009-12-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: You could make all namedtuples inherit from a common base class, e.g. `BaseNamedTuple`. -- nosy: +pitrou ___ Python tracker ___

[issue7434] pprint doesn't know how to print a namedtuple

2009-12-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: I agree with you that pprint needs to be rewritten to make it more extensible. I do not see a straight-forward way of handling your feature request. First, namedtuple() is a factory function and is not itself a class, so there is no standard way to recogniz

[issue7434] pprint doesn't know how to print a namedtuple

2009-12-04 Thread Benjamin Peterson
Changes by Benjamin Peterson : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue7434] pprint doesn't know how to print a namedtuple

2009-12-04 Thread Anthony Foglia
New submission from Anthony Foglia : It would be nice if pprint could format namedtuples wrapping lines as it does with tuples. Looking at the code, this does not look like an easy task. Completely rewriting pprint to allow it to be extensible to user-created classes would be best, but involve