What should Python apps do when asked to show help?

Dan Strohl D.Strohl at F5.com
Thu Apr 28 13:32:29 EDT 2016


I would hesitate to take this approach unless the tool was one that only I was going to be using, and I knew exactly what environments it was going to be in.

I know that many of the system items in python work differently in different operating systems, and different os's report things differently as well as different ways of launching things.  So, for example, I have seen cases where tools such as webmin will try to run a command line tool, and end up hung because they are waiting on a keypress for the next screen... 

While I might do it as a way of setting a default, I would still want to have the ability to force a pager, or force no pager.  I've been bit too many times by programmers doing things automatically for me that I didn't want.

I think that most people who use command line tools these days will be able to figure out how to pipe it to "more" if needed (or whatever).

Dan


> -----Original Message-----
> From: Python-list [mailto:python-list-bounces+d.strohl=f5.com at python.org]
> On Behalf Of Irmen de Jong
> Sent: Thursday, April 28, 2016 10:08 AM
> To: python-list at python.org
> Subject: Re: What should Python apps do when asked to show help?
> 
> On 28-4-2016 18:33, Steven D'Aprano wrote:
> 
> 
> > but I was thinking of doing both: give my application a subcommand or
> > an option to display help directly in a pager, while -h and --help
> > print to stdout as normal.
> >
> > What do you think? Too clever?
> 
> An idea: Use just one help option, then
> 
> if sys.stdout.isatty():
>     #....use a pager to display help text
> else:
>     #....print all help text normally
> 
> 
> Irmen
> 
> --
> https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list