Today I found very useful tips from the CDAT document page about how to make auto completion in python shell.
Save the above code as .auto_completion_python_shell.py inyour home directory of your home directory in *nix system.
Then open the .bashrc by
$ gedit .bashrc
add the following line at the end of the file.
Save the file and close it. Close the terminal.
Now reopen the terminal, issue the command python
>>> im[tab] [tab]
it should automatically complete the import command.
It also displays the available methods, and variables of any object in the shell prompt.
Of-course it will not be fashion as "bpython" and "ipython"…
But in some situations, python shell is best compare to bpython when we accessing large set of data.
In some cases bpython ncurses fails to handle large set of data…
Those cases we can apply our own PYTHONSTARTUP script to make it as auto complete commands…
Note : This auto completion will works only under shell, not under $python -i some_script.py (not under interactive script shell).