Abbreviated repr

13 views
Skip to first unread message

Ryan McCampbell

unread,
Jan 26, 2018, 12:47:48 PM1/26/18
to beautifulsoup
This is a suggestion. I think it would be nice if the __repr__ of all bs4 elements was abbreviated beyond a certain size, kind of like how numpy abbreviates large arrays. This would be really useful for interactive use when you don't want to accidentally print an entire html page. However the __str__ should be kept unabbreviated so explicit print()s will still work as they do now. 

David Goldsmith

unread,
Jan 26, 2018, 2:47:55 PM1/26/18
to beauti...@googlegroups.com
+1 (Surprised this isn't already the behavior.)

On Fri, Jan 26, 2018 at 9:47 AM Ryan McCampbell <rmccam...@gmail.com> wrote:
This is a suggestion. I think it would be nice if the __repr__ of all bs4 elements was abbreviated beyond a certain size, kind of like how numpy abbreviates large arrays. This would be really useful for interactive use when you don't want to accidentally print an entire html page. However the __str__ should be kept unabbreviated so explicit print()s will still work as they do now. 

--
You received this message because you are subscribed to the Google Groups "beautifulsoup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beautifulsou...@googlegroups.com.
To post to this group, send email to beauti...@googlegroups.com.
Visit this group at https://groups.google.com/group/beautifulsoup.
For more options, visit https://groups.google.com/d/optout.
--
From "A Letter From The Future" in "Peak Everything" by Richard Heinberg:

"By the time I was an older teenager, a certain...attitude was developing among the young people...a feeling of utter contempt for anyone over a certain age--maybe 30 or 40.  The adults had consumed so many resources, and now there were none left for their own children...when those adults were younger, they [were] just doing what everybody else was doing...they figured it was normal to cut down ancient forests for...phone books, pump every last gallon of oil to power their SUV's...[but] for...my generation all that was just a dim memory...We [grew up] living in darkness, with shortages of food and water, with riots in the streets, with people begging on street corners...for us, the adults were the enemy."

Want to really understand what's really going on?  Read "Peak Everything."


Reply all
Reply to author
Forward
0 new messages