472,980 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,980 software developers and data experts.

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 2960
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_function_or_method
Base Class: <type 'builtin_function_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("blahblah"), "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.expanduser("~/.pyhistory")
historyTmp = os.path.expanduser("~/.pyhisttmp.py")

endMarkerStr= "# # # histDUMP # # #"

saveMacro= "import readline;
readline.write_history_file('"+historyTmp+"'); print '####>>>>>>>>>>';
print ''.join(filter(lambda lineP: not
lineP.strip().endswith('"+endMarkerStr+"'),
open('"+historyTmp+"').readlines())[:])+'####<<<<<<<<<<'"+endMarkerStr

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

def save_history(historyPath=historyPath, endMarkerStr=endMarkerStr):
import readline
readline.write_history_file(historyPath)
# Now filter out those line containing the saveMacro
lines= filter(lambda lineP, endMarkerStr=endMarkerStr: not
lineP.strip().endswith(endMarkerStr), open(historyPath).readlines())
open(historyPath, 'w+').write(''.join(lines))

if os.path.exists(historyPath):
readline.read_history_file(historyPath)

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
дамјан г. wrote:

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")


I say thank you ! This works like a charm.
Somehow I've never discovered rlcompleter... :-)

--Irmen

Jul 18 '05 #11
Dang Griffith <no*****@noemail4u.com> writes:
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


Actually you can get all this on win32 if you use the cvs version of
IPython and Gary Bishop's Python readline module. There is a URL
and instructions on how to set it up here.
http://www.scipy.net/pipermail/ipyth...er/000094.html
The Python readline module needs ctypes so get that as well.
Works with Python 22 and 23 and gives you readline functionality and
colour highlighting when using IPython under win32.

Sean
--
"Hver sin smak", sa vintapperen, han drakk mens de andre sloss.
Jul 18 '05 #12
?????? ?. <mk@net.mail.penguinista> wrote:
# ~/.pythonrc
# enable syntax completion
try:
import readline
except ImportError:
print "Module readline not available."
else:
import rlcompleter
readline.parse_and_bind("tab: complete")


This will work on win32 as well if you download ctypes and then my
python implementation of gnu readline from

http://prdownloads.sourceforge.net/u...1.zip?download

It also includes the ability to translate ascii color escapes into
colors on windows for use with iPython.

gb

Jul 18 '05 #13
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.
As the ipython developer, you could say that I'm biased :) But you could
simply try it and see if you like it. It's a simple python package with no C
dependencies (under *nix), so getting it going is pretty straightforward.

I personally can't stand using the standard python shell anymore, which to me
feels like a crippled toy. But YMMV.

As Sean pointed, some of its nicer features (readline and color support) are
finally available to Windows XP/2k users, but only with CVS code. I'll be
making a new release soon-ish, but I want to clean some other outstanding
small bugs before that.
If it is so good then why is it not part of the standard Python
tarball?


I'd like it to, but I haven't even considered proposing such an idea. Right
now the ipython internals are a heinous mess, and nobody in their sane mind
would accept to maintain such a codebase. But there's hope for a rewrite with
the help of some dedicated users (I have very limited time for its
development). If we manage to clean it up completely, it might be conceivable
to propose it for the standard distribuition (not as a replacement, but as an
alternative: it's still slower to load and more complex code).

Regards,

Fernando.
Jul 18 '05 #14
"Gary Bishop" <gb@cs.unc.edu> wrote in message news:<3f********@news.unc.edu>...
?????? ?. <mk@net.mail.penguinista> wrote:
# ~/.pythonrc
# enable syntax completion
try:
import readline
except ImportError:
print "Module readline not available."
else:
import rlcompleter
readline.parse_and_bind("tab: complete")


This will work on win32 as well if you download ctypes and then my
python implementation of gnu readline from

http://prdownloads.sourceforge.net/u...1.zip?download


Brilliant! Thank you very much indeed.

I would add a warning for those Windows users who aren't also Linux
users: by default you'll need to use Ctrl-D to exit the interpreter
rather than Ctrl-Z. (I imagine this could be changed; I've given the
source no more than a cursory glance).

TJG
Jul 18 '05 #15

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

Similar topics

1
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....
1
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. ...
3
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...
28
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
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...
1
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...
5
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...
0
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`,...
1
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...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.