IDLE Namespace Toolbox? Windows.

W

W. eWatson

This is a follow up to my post "Changing Lutz's mydir. It would seem
there should be some sort of toolbox that allows one to do things like
mydir, and perhaps a lot more. Maybe something like it exists in Linux.
I'm a Windows user. I've found it a bit aggravating that using dir and
help, for example, that the output just rolls on off the screen and I
have to play around with the shell scroll bars to find what I'm looking
for. A few simple changes to mydir should change that, but I would hope
or think maybe there are even more tools to generally help.
 
C

Chris Rebert

This is a follow up to my post "Changing Lutz's mydir.  It would seem there
should be some sort of toolbox that allows one to do things like mydir, and
perhaps a lot more. Maybe something like it exists in Linux.

Indeed; on *nix, when in the terminal, python invokes the pager[1]
(which splits text into pages and lets you move between them, hence
the name) for documentation that is longer than one screen. Apparently
there are pagers available for Windows, but I don't know whether
Python tries to use them or not.

Perhaps try installing one, setting the PAGER environment variable,
and see what happens when run python from the terminal and invoke
help()? And/or file a bug if Python indeed doesn't try to invoke a
pager on Windows.

Of course, this won't do anything about IDLE's shell, which isn't a
proper terminal.

Cheers,
Chris
 
J

John Bokma

W. eWatson said:
This is a follow up to my post "Changing Lutz's mydir. It would seem
there should be some sort of toolbox that allows one to do things like
mydir, and perhaps a lot more. Maybe something like it exists in
Linux. I'm a Windows user. I've found it a bit aggravating that using
dir and help, for example, that the output just rolls on off the
screen and I have to play around with the shell scroll bars to find
what I'm looking for. A few simple changes to mydir should change
that, but I would hope or think maybe there are even more tools to
generally help.

on the command prompt:

cmd | more

works
 
W

W. eWatson

John said:
on the command prompt:

cmd | more

works
Apparently, not in IDLE under Win.Traceback (most recent call last):
File "<pyshell#42>", line 1, in <module>
dir() | more
NameError: name 'more' is not defined
 
C

Chris Rebert

Apparently, not in IDLE under Win.
Traceback (most recent call last):
 File "<pyshell#42>", line 1, in <module>
   dir() | more
NameError: name 'more' is not defined

Er, that's supposed to be run in the terminal, not in IDLE. Presumably
you'd then run python.exe from the same terminal after issuing that
command.

Cheers,
Chris
 
M

MRAB

W. eWatson said:
Apparently, not in IDLE under Win.
Traceback (most recent call last):
File "<pyshell#42>", line 1, in <module>
dir() | more
NameError: name 'more' is not defined

He said "command prompt", not Python prompt.
 
A

alex23

I've found it a bit aggravating that using dir and
help, for example, that the output just rolls on off the screen and I
have to play around with the shell scroll bars to find what I'm looking
for. A few simple changes to mydir should change that, but I would hope
or think maybe there are even more tools to generally help.

If you haven't already, you really should check out IPython:
http://ipython.scipy.org

It's an enhanced interactive shell packed full of convenience
features. For example, output is by default paged, so you'll get the
behaviour you want from help() and dir() straight away. However,
you'll probably end up using IPython's help instead: <object>? will
not only display the docstring, it'll provide metadata about the
object, such as its base class, the file it was defined in and even
the namespace it exists in.

%page <object> will pretty print the object and run it through the
pager.
%timeit <statement|expression> is an _exceptionally_ handy wrapper
around the timeit module.
%bg <statement> runs in a separate, background thread

There's a directory stack, macros, code in history can be edited,
profiling & debugging, functions can be called without parenthesis
(nice if you use IPython as a shell replacement), and you can easily
capture the results of a command line call to a variable.

But yes, along with all that, it pages object printing :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,254
Latest member
Top Crypto TwitterChannel

Latest Threads

Top