Chris Withers wrote:
Sverker Nilsson wrote:

The __repr__ I use don't have the enclosing <>, granted, maybe I missed
this or it wasn't in the docs in 2005 or I didn't think it was important
(still don't) but was that really what the complain was about?


No, it was about the fact that when I do repr(something_from_heapy) I get a shedload of text.

I thought it was more useful to actually get information of what was
contained in the object directly at the prompt, than try to show how to
recreate it which wasn't possible anyway.


Agreed, but I think the stuff you currently have in __repr__ would be better placed in its own method:

 >>> heap()
<IdentitySet object at 0x0000 containing 10 items>

For what it's worth, the container class I wrote recently to hold dbf rows is along the lines of Chris' suggestion; output is similar to this:

DbfList(97 records)

or, if a description was provided at list creation time:

DbfList(State of Oregon - 97 records)

basically, a short description of what's in the container, instead of 97 screens of gibberish (even usefull information is gibberish after 97 screenfulls of it!-)

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to