[issue5131] pprint doesn't know how to print a defaultdict

2014-01-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Closing this as a duplicate of issue 7434 (which is about redesigning pprint to 
make it easier to add support for new types)

--
nosy: +ncoghlan
resolution: accepted - duplicate
stage: patch review - committed/rejected
status: open - closed
superseder:  - general pprint rewrite

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2010-11-08 Thread Rodrigo Bernardo Pimentel

Changes by Rodrigo Bernardo Pimentel r...@isnomore.net:


--
nosy: +rbp

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2010-10-01 Thread Nick Craig-Wood

Nick Craig-Wood n...@craig-wood.com added the comment:

Terry J. Reedy (terry.reedy) wrote:
  IMHO pprint should be able to make a decent job of all the built in types 

 Agreed, already true as far as I know, and irrelevant. This issue is not 
 about built-in types in the builtins module, as documented Lib Ref chapter 5 
 *Built-in Types*. Collections is an Python-coded stdlib  module that happens 
 to import a couple of its classes from _collections, written in C for speed. 

My bad - not precise enough!  I meant all the stdlib types rather than the 
builtin types.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2010-09-29 Thread Nick Craig-Wood

Nick Craig-Wood n...@craig-wood.com added the comment:

Raymond Hettinger (rhettinger) wrote:
 Ben, I don't think there is any value is opening more issues like 
 pprint-doesn't-handle-object-x (named tuples, defautdicts, deques, 
 generators, etc).
 
 As it is currently designed, pprint doesn't offer usable hooks and it is not 
 easy to build-out to handle new object types.  For the most part, users just 
 cast to a list before calling pprint.

I mildly disagree, IMHO pprint should be able to make a decent job of all the 
built in types otherwise it loses its value as a debugging tool.  It is a 
suprise when a built in type doesn't pprint properly.

This would surely be an excellent use of the abstract base classes defined in 
the collections module for pprint to make a best guess as to how to print types 
it doesn't understand directly?

 ISTM, the RightAnswer(tm) is to overhaul pprint and add hooks for handling 
 new objects.  Ideally, there would be flexible print options and reprlib-like 
 features for limiting output and for marking recursive constructs with ...

That is a very good idea, but might be unecessary with the ABC idea above

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2010-09-29 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

IMHO pprint should be able to make a decent job of all the built in types 

Agreed, already true as far as I know, and irrelevant. This issue is not about 
built-in types in the builtins module, as documented Lib Ref chapter 5 
*Built-in Types*. Collections is an Python-coded stdlib  module that happens to 
import a couple of its classes from _collections, written in C for speed. 

I agree with Raymond that pprint needs a generic solution better than 
special-casing one class after another. Your idea of using ABCs intriguing.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2010-09-28 Thread Ben Bass

Ben Bass benpaulb...@googlemail.com added the comment:

Same applies to collections.deque, which seems closely related (being another 
collections class).  Can this get addressed here or should I open another issue?

(just been pprinting defaultdict(deque) objects, which clearly fails :)

--
nosy: +bpb

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2010-09-28 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Ben, I don't think there is any value is opening more issues like 
pprint-doesn't-handle-object-x (named tuples, defautdicts, deques, generators, 
etc).

As it is currently designed, pprint doesn't offer usable hooks and it is not 
easy to build-out to handle new object types.  For the most part, users just 
cast to a list before calling pprint.

ISTM, the RightAnswer(tm) is to overhaul pprint and add hooks for handling new 
objects.  Ideally, there would be flexible print options and reprlib-like 
features for limiting output and for marking recursive constructs with ...

It would be better to start fresh than to continually pile on to the current 
hodge-podge.

--
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2010-08-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Jack, can you update your patch to reflect Terry’s review?

Amaury, have you opened a feature request about your registration idea?

--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2010-08-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

BTW, Tarek’s name is valid UTF-8 in py3k.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2010-07-22 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

Patch looks good to me.
(Some day the pprint module should grow some way to register repr for user 
types, so we can stop adding special cases; but defaultdict() is a builtin)

--
nosy: +amaury.forgeotdarc
resolution:  - accepted

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2010-07-08 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

I removed 'a set or' from the title since sets are no longer an issue.

Since .fromkeys is a class method, it should be called on a class rather than 
an instance. I was initially fooled by the irrelevant addition of '(int)'. 100 
is unnecessarily large for example and review.

Patch changes code and test. However, I cannot tell what effect is has merely 
from reading the patch. Please add an example of the altered output, with 100 
lowered to 5 or 10.

A doc change is not needed since it merely says The pprint module provides a 
capability to “pretty-print” arbitrary Python data structures 

I suspect the patch needs some update to apply to for 3.2a. Has Tarek's name 
been fixed already?

--
nosy: +tjreedy
stage:  - patch review
title: pprint doesn't know how to print a set or a defaultdict - pprint 
doesn't know how to print a defaultdict
versions: +Python 3.2 -Python 2.5, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5131] pprint doesn't know how to print a defaultdict

2010-07-08 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
nosy: +fdrake

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com