As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label help. Show all posts

This post is part of April Fool's Day joke. Nothing to test. ;)
To my dear readers,

I rarely ask help. In fact, I don't think I have ever done this on my blog. Right now, I need your help to test a thing I have been developing for months. You should be able to see it in the following box:

This is a place holder message.
If you are reading this, then
it is not supported by your feed reader.
Please view it on my blog.

If you see a place holder message, please go to my blog via the link provided by your feed reader or via the homepage of my blog. It should be showing you something like an image, try to play it around and tell me what you think about it.

Please comment with the name and link of your feed reader which does not support. Please comment with your browser's version if you still can't see on my blog.

Thank you for your help!

PS. this is a time-limited testing (based on your IP address) and some of you may have tried or seen the sneaky preview already, therefore you may only see the place holder message even your browser supports it.

I just accidentally discovered there is a Bash builtin help (by typing hel for auto-complete), and it is really helpful.

The following is an example:
$ help help
help: help [-dms] [pattern ...]
    Display information about builtin commands.
    Displays brief summaries of builtin commands.  If PATTERN is
    specified, gives detailed help on all commands matching PATTERN,
    otherwise the list of help topics is printed.
      -d        output short description for each topic
      -m        display usage in pseudo-manpage format
      -s        output only a short usage synopsis for each topic matching
      PATTERN   Pattern specifiying a help topic
    Exit Status:
    Returns success unless PATTERN is not found or an invalid option is given.
You can read the options, arguments, and explanations. I realized I had spent (wasted) too much time on scrolling and searching in Bash manpage for the same stuff.

Someone asked why does "help(import)" not work? I know the reason but it's not why I wanted to write about here. One reply exposed that I didn't know much about help. It shows a usage, that I had never known before:

You can pass a string type, I also thought help is just printing out __doc__. And yes string also has __doc__, but why would you do that? Why would you want to get __doc__ of an instance of int, str, list, etc? So I never tried to pass a string to help.

Therefore I didn't known I could even get help about keywords. Moreover, I thought help was a function, which is not after I dug in. help is an instance of site._Helper. site module will be loaded automatically when you fire up Python interactive shell. Once it load, the help in shell is an instance of site._Helper.

If you invoke help without any arguments, help(), this will bring you to interactive help, I had never tried to use help without passing an object before.

This is actually invoking site._Helper.__call__, which is an instance method, means the instance of site._Helper is callable, and that's the way you get into interactive help.

site._Helper also has overridden __repr__ method, if you just type help and hit enter. The interactive shell will actually invoke this __repr__ method, and that's how we get this hint
Type help() for interactive help, or help(object) for help about object.

Note this does not directly mention that you can use help('string'), where string could be a module name, a keyword, or a topic. But you can know it from the message after you quit interactive help:
>>> help()

Welcome to Python 2.6! This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> quit

You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)". Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.

Maybe this is my excuse that I did know help better.