-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add paging #2
Comments
Using something like curses? It may adds more complexity so I'll think over it. |
No, curses isn't supported on Windows. |
That's a good point. I'll take your advice, thanks. |
I'd recommend against doing this manually, just use one of the It's part of the standard library and works great. |
Thanks @aluttik, I'll take a look. |
There's already an in-production solution implemented by IPython, easy to use and cross-platform, hardly documented though. Try: import IPython
IPython.core.page.page("\n".join(map(str, range(100)) The output would be pretty much like a man page. As I see it, the biggest problem is not the technical problem, rather, it's about user-interface. As demonstrated by the example in the README of this project, we usually use |
I'm not against adding the paging logic to I'm not quite sure what you mean by "refactor PrettyDir to a single function like dir". |
What I meant is to define a new interface for users: def pdir(obj):
output = repr(PrettyDir(obj))
if too_long(output):
paging(output)
else:
print(output) At first glance chaining and filtering become impossible because nothing is returned. After some workaround they may be realized though to my knowledge it'll be less simple and elegant than previous implementation. |
I see. As the first step, we can verify if things work by creating a program and overriding |
|
I don't have a strong preference on implementation, as long as they work across all supported REPLs, or at least don't break existing functionality when not compatible. |
Alright, I'll see what I can do with it. |
Some classes return a very long output. Maybe paginate it?
The text was updated successfully, but these errors were encountered: