Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit amount of items shown #11

Open
kootenpv opened this issue Sep 14, 2016 · 2 comments
Open

Limit amount of items shown #11

kootenpv opened this issue Sep 14, 2016 · 2 comments

Comments

@kootenpv
Copy link

Great idea! I like how you truncate long lines. I have a class on which it works really nicely, except that it contains a dictionary with many items. Perhaps you could come up with some smart way to truncate only if there are too many keys to be shown (and then not to display)?

In my case I can say that I consider 185 keys too much to be "beeprinted" :-)

Or perhaps for classes, consider a "depth" variable that perhaps indicates scaling.

self.somedict will show, say, 20 items at most
self.deeper.somedict will show, say, 7 items at most
self.deeper.evendeeper.somedict will show, say, 3 items at most

You could do this to any kind of depth, e.g. a dict in a list will show fewer entries than if it would just be a list, and perhaps a dict in a dict in a list even fewer :)

@kootenpv kootenpv changed the title Limit amount of keys shown Limit amount of items shown Sep 14, 2016
@panyanyany
Copy link
Owner

hi, what your describe is also my concern.

when people use beeprint means they don't know what exactly in the class/dict. so they need to print it all out to find something important.

if i limit the items, it would happen to hide important ones!

but, the children of first level items people may not care about very much.

so, what about this idea:

for any object:
  show all of first level items.
    to nested items, hidden all if last level items is too long, show all if not.

@kootenpv
Copy link
Author

Note that I honestly wouldn't be concerned to try multiple runs through all the items, first to find out all the depths, then to print the best way. The reason is that printing itself is already really slow, so people shouldn't use it at critical moments. When people do want speed, you might offer a "fast" mode.

More ideas:

  • Perhaps consider a "budget", like printing at most 50 attributes.
    • Make it breadth first; first print everything of the first level, then print of the second level.
  • Perhaps consider also how many characters per line. If very short values, more attributes allowed.
  • Perhaps consider sumarizing over level if too many items, just like with cutting the middle part of long "lines". But in that case, perhaps write like int[100].

Lot's of ideas, but I understand it is difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants