Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IDLE Namespace Toolbox? Windows.

0 views
Skip to first unread message

W. eWatson

unread,
Jan 17, 2010, 10:22:27 PM1/17/10
to
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.

Chris Rebert

unread,
Jan 17, 2010, 11:09:20 PM1/17/10
to pytho...@python.org
On Sun, Jan 17, 2010 at 2:22 PM, W. eWatson <wolft...@invalid.com> wrote:
> 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
--
http://blog.rebertia.com

Chris Rebert

unread,
Jan 17, 2010, 11:10:44 PM1/17/10
to pytho...@python.org
On Sun, Jan 17, 2010 at 3:09 PM, Chris Rebert <cl...@rebertia.com> wrote:
> On Sun, Jan 17, 2010 at 2:22 PM, W. eWatson <wolft...@invalid.com> wrote:
>> 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]

[1]: http://en.wikipedia.org/wiki/Terminal_pager

(postscript got clipped off accidentally)
- Chris

John Bokma

unread,
Jan 17, 2010, 11:11:28 PM1/17/10
to
"W. eWatson" <wolft...@invalid.com> writes:

on the command prompt:

cmd | more

works

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development

W. eWatson

unread,
Jan 18, 2010, 12:11:11 AM1/18/10
to
John Bokma wrote:
> "W. eWatson" <wolft...@invalid.com> writes:
>
>> 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
>
Apparently, not in IDLE under Win.
>>> dir() | more
Traceback (most recent call last):
File "<pyshell#42>", line 1, in <module>
dir() | more
NameError: name 'more' is not defined

Chris Rebert

unread,
Jan 18, 2010, 12:20:43 AM1/18/10
to pytho...@python.org

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.

MRAB

unread,
Jan 18, 2010, 12:44:57 AM1/18/10
to pytho...@python.org

He said "command prompt", not Python prompt.

alex23

unread,
Jan 18, 2010, 4:40:41 AM1/18/10
to
On Jan 18, 8:22 am, "W. eWatson" <wolftra...@invalid.com> wrote:
> 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 :)

0 new messages