473,765 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

should i switch to IPYTHON interpreter? What is the killer feature of it?

I know IPython is another interpreter for Python and was wondering
what people liked about it and if I should switch to it.

If it is so good then why is it not part of the standard Python
tarball?

Chris
Jul 18 '05 #1
14 3007
se******@spawar .navy.mil (Christian Seberino) writes:
I know IPython is another interpreter for Python and was wondering
what people liked about it and if I should switch to it.
Some things i like are .....

Typing ? after a function name gives you the function definition and
docstrings for the function. i.e arange? returns

Type: builtin_functio n_or_method
Base Class: <type 'builtin_functi on_or_method'>
String Form: <built-in function arange>
Namespace: Interactive
Docstring:
arange(start, stop=None, step=1, typecode=None)

Just like range() except it returns an array whose type can be
specified by the keyword argument typecode.

Normal shell commands like cd & ls are available

Tab completion for keywords and methods etc (you can get this in the
standard python shell as well of course)

Heaps more features but those are the killers for me (YMMV)
If it is so good then why is it not part of the standard Python
tarball?


No idea. It's no big deal for me to download it separately and install
it. You could ask the same question about many other Python packages,
if they were all included the distribution would start getting a bit
big I think.

Anyway give IPython a try I think you will like it.

Sean

--
"Hver sin smak", sa vintapperen, han drakk mens de andre sloss.
Jul 18 '05 #2
Sean Richards wrote:

Tab completion for keywords and methods etc (you can get this in the
standard python shell as well of course)


You can? How?

--Irmen

Jul 18 '05 #3
On 9 Dec 2003 16:19:35 -0800, se******@spawar .navy.mil (Christian
Seberino) wrote:
I know IPython is another interpreter for Python and was wondering
what people liked about it and if I should switch to it.

If it is so good then why is it not part of the standard Python
tarball?

Chris

I use it on Win32 and like that it provides a simpler/more direct
interface to the file system. I.e., I can do things such as "cd
blahblahblah" and change the directory, rather than importing os and
calling os.chdir("blahb lah"), "ls" instead of os.listdir('.') , and
that sort of thing. Also, you can create your own command aliases,
along the lines of cshrc, bash, etc.

Another feature I've used, at least occasionally, is the ability to
save the session history. When I'm exploring a module I've not used
before, I do a lot of schtuff that doesn't work, get it to work, then
move forward (not work, work, not work, work). By the time I've
reached my goal, though, I've become addled and have forgotten which
pieces parts works and which didn't. With IPython, I can save that
history and review what worked and what didn't, delete the chaff and
try the wheat again later.

At least one reason it's not part of the standard tarball is that it's
owned by a different group of people.

--dang
p.s.
One could argue that my approach to learning new modules could use
improvement. And while that may be true, I've found that learning to
recognize error messages, and what causes them, makes it easier to
help others.
Jul 18 '05 #4
On Wed, 10 Dec 2003 11:19:21 +0100, Irmen de Jong
<irmen@-NOSPAM-REMOVETHIS-xs4all.nl> wrote:
Sean Richards wrote:

Tab completion for keywords and methods etc (you can get this in the
standard python shell as well of course)


You can? How?

--Irmen


Press tab after typing part of the keyword/method.

This assumes you're *not* using Win32. The documentation says that
IPython requires the GNU readline function, which I guess isn't
available with Win32. Neither is color highlighting.

--dang
Jul 18 '05 #5
Dang Griffith wrote:
Tab completion for keywords and methods etc (you can get this in the
standard python shell as well of course)


You can? How?

--Irmen

Press tab after typing part of the keyword/method.


Sean was talking about the 'standard python shell' so I tried
the default python (2.3) on my mandrake 9.2 box.
It doesn't work, it just inserts a tab character.

--Irmen

Jul 18 '05 #6
<snip>
One could argue that my approach to learning new modules could use
improvement. And while that may be true, I've found that learning to
recognize error messages, and what causes them, makes it easier to
help others.

I would say you have nothing to apologize for, this approach to learning new
modules sounds strikingly similar to my own. It's part of what I think is a
big advantage to Python (and similar scripting languages), that you can
engage in a highly efficient, quick turnaround, exploratory process, without
the overhead and delay of compile/correct-syntax-errors/compile/link/run.
The immediate feedback (and sometimes, gratification) allows you to stay in
that high-intensity mental zone, without the distractions of awkward
meta-tasks, for hours at a time (or days or weeks!).

-- Paul
Jul 18 '05 #7
> Sean was talking about the 'standard python shell' so I tried
the default python (2.3) on my mandrake 9.2 box.
It doesn't work, it just inserts a tab character.


I use rlcompleter2 for this - in the standard shell. Very nice - but I think
I've got to take a look at IPython, too.

Diez
Jul 18 '05 #8
Irmen de Jong wrote:
Dang Griffith wrote:
Tab completion for keywords and methods etc (you can get this in the
standard python shell as well of course)
You can? How?

--Irmen


Press tab after typing part of the keyword/method.

Sean was talking about the 'standard python shell' so I tried
the default python (2.3) on my mandrake 9.2 box.
It doesn't work, it just inserts a tab character.

--Irmen

You need an startup-file for python.

(I copied this together out of python-news-mail (thank you once again)
and some own ideas)

..pystartup in your home-dir

# Add auto-completion and a stored history file of commands to your Python
# interactive interpreter. Requires Python 2.0+, readline. Autocomplete is
# bound to the Esc key by default (you can change it - see readline docs).
#
# Store the file in ~/.pystartup, and set an environment variable to point
# to it, e.g. "export PYTHONSTARTUP=/max/home/itamar/.pystartup" in bash.
#
# Note that PYTHONSTARTUP does *not* expand "~", so you have to put in the
# full path to your home directory.

import atexit
import os
import readline
import rlcompleter

historyPath = os.path.expandu ser("~/.pyhistory")
historyTmp = os.path.expandu ser("~/.pyhisttmp.py")

endMarkerStr= "# # # histDUMP # # #"

saveMacro= "import readline;
readline.write_ history_file('" +historyTmp+"') ; print '####>>>>>>>>>> ';
print ''.join(filter( lambda lineP: not
lineP.strip().e ndswith('"+endM arkerStr+"'),
open('"+history Tmp+"').readlin es())[:])+'####<<<<<<<< <<'"+endMarkerS tr

readline.parse_ and_bind('tab: complete')
readline.parse_ and_bind('\C-w: "'+saveMacro+'" ')

def save_history(hi storyPath=histo ryPath, endMarkerStr=en dMarkerStr):
import readline
readline.write_ history_file(hi storyPath)
# Now filter out those line containing the saveMacro
lines= filter(lambda lineP, endMarkerStr=en dMarkerStr: not
lineP.strip().e ndswith(endMark erStr), open(historyPat h).readlines())
open(historyPat h, 'w+').write(''. join(lines))

if os.path.exists( historyPath):
readline.read_h istory_file(his toryPath)

atexit.register (save_history)

del os, atexit, readline, rlcompleter, save_history, historyPath,
historyTmp, endMarkerStr, saveMacro
(I hope spaces will survive mailing)

Additionaly you need to
~# export PYTHONSTARTUP=/root/.pystartup

You can do this e.g. in .profile
Pressing tab completes the input like common unix-shells.
Pressing CTRL-w gives You an python code to print the history-file (or
parts of it -- there's a [:] in the command that You can replace by
[-50:]; which will give you the last 50 lines)
cu cbf


Jul 18 '05 #9
Tab completion for keywords and methods etc (you can get this in the
standard python shell as well of course)

You can? How?


Press tab after typing part of the keyword/method.


Sean was talking about the 'standard python shell' so I tried
the default python (2.3) on my mandrake 9.2 box.
It doesn't work, it just inserts a tab character.


Put this in ~/.pythonrc, and setup the PYTHONSTARTUP environment variable to
point to it: export PYTHONSTARTUP=~/.pythonrc
# ~/.pythonrc
# enable syntax completion
try:
import readline
except ImportError:
print "Module readline not available."
else:
import rlcompleter
readline.parse_ and_bind("tab: complete")
--
Дамјан (jabberID:da*** *@bagra.net.mk)

I believe the technical term is "Oops!"
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2651
by: Yaroslav Bulatov | last post by:
> Hi, > > Equis Uno wrote: > > > I use meta-x shell to start a shell and then once I see a shell > > prompt I enter the python command and I get a well-behaved python > > shell inside of emacs. > > > > I'm trying to figure out the best way to run ipython inside of emacs.
1
1514
by: Ismael Herrera | last post by:
Hi,i wonder if there is an editor or ide that has similar dinamic instrospection features as ipython? ,since i have failed to find one, i spend more time coding in ipython than in my editor. Well the feature i need the most is tab introspection since python has so many libraries and functions that is imposible to remember all of them.For example when i type urllib2.<tab> i get: urllib2.AbstractBasicAuthHandler urllib2.__class__...
3
1565
by: Dave Merrill | last post by:
Hi, I'm new to python, and ipython, but not to programming, having trouble getting ipython installed on windows 2000, python 233. Any help would be much appreciated; I'm sure I'm being some basic flavor of dense... First downloaded and installed PythonWin, readline and ctypes. They're all pretty clearly here and working, because I can run PythonWin, and from there, importing readline and ctypes works. Then downloaded ipython-0.6.6.zip...
28
2800
by: grahamd | last post by:
Who are the appropriate people to report security problems to in respect of a module included with the Python distribution? I don't feel it appropriate to be reporting it on general mailing lists.
1
1727
by: Jeremy Jones | last post by:
I've written an article on IPython which is now live on O'Reilly's ONLamp site at http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html. All feedback is welcome. Regardless of what you may think of the article, I hope it encourages everyone to at least try out IPython. IPython has become an indispensible tool in my toolbox. I cannot say enough great things about it. Jeremy Jones
1
1954
by: Michael Tobis | last post by:
It appears that doctest does not work straightforwardly within iPython. I would like to be able to use doctest within a file conditionally, so that I can develop it within ipython and test it otherwise. It would seem that this would work: Python 2.4.1 (#2, Mar 31 2005, 00:05:10) on darwin
5
3283
by: Lou Pecora | last post by:
I installed the SciPy superpackage and have pylab, matplotlib, scipy, and numpy apparently running well. But I want to use matplotlib/pylab interactively. The instructions suggest doing this in IPython. But using ipython on the command line gives me an error. The system doesn't know the command. Apparently there is no ipython executable in one of the bin directories. I thought the superpackage would add that automatically, but I...
0
928
by: Karlo Lozovina | last post by:
Hi all! I have a runTest() function inside my module, which sets up and initializes lots of objects and performs some basic tests on them. Usually (from IPython) I just write `run my_module.py`, and then `runTest()`. But sometimes I would like to manually twiddle with objects runTest creates. Is there any way I can "return" all those objects local to runTest(), and have them available in IPython (or ordinary Python shell)? Thanks...
1
1102
by: Casey | last post by:
I'm running python 2.5.2 on WinXP. I've always used a GUI for interactive development, but I wanted to try out ipython which better supports matplotlib in this mode. Unfortunately, whenever I try to use help() I get the following error: (Sys) The system cannot find the file specified. "C:\documents" It turns out that the regular (python.exe) interpreter has the same problem. I have the HTML docs installed, my PYTHONDOCS environment
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9955
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9833
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.