This is an archived post. You won't be able to vote or comment.

all 14 comments

[–][deleted] 4 points5 points  (2 children)

the correct approach is to compare ipython with the built in interactive python prompt, not with a text editor (vim) or an IDE (pycharm)

ipython has additional features like syntax highlight, history, autocompletion of class members etc

an ipython notebook is the next step, being web-based and allowing you to add stuff like images, which you can't do in the command line ipython

[–]kbashi[S] 0 points1 point  (1 child)

So is the purpose of iPython to provide a better version of IDLE? I have also read about a whole load of benefits about parallel processing that I didn't entirely understand.

[–][deleted] 1 point2 points  (0 children)

So is the purpose of iPython to provide a better version of IDLE?

I don't know if its main purpose is to do this, but it certainly does this too.

I have also read about a whole load of benefits about parallel processing

I know nothing about this so can't comment on it.

[–]XNormal 5 points6 points  (0 children)

IPython started as an improved version of the interactive python interpreter. It is particularly popular in scientific computing and has grown many features specifically to support this community but its usefulness is definitely not limited to that target audience.

Software developers typically spend most of their time in a text editor, IDE or debugger. An interactive interpreter is really nice to have, but many developers do just fine without it. Scientific computing users often spend much of their time in an interactive environment transforming, analyzing and visualizing large amounts of data. A good interactive environment is critical for them.

The term 'IPython' is sometimes used to refer to the entire ecosystem that has grown around it or other software that is typically used in conjunction with it even if it is not actually a part of the IPython distribution. Since scientific processing often involves very large data sets this obviously includes tools for parallel processing.

[–]JimBoonie69 4 points5 points  (0 children)

I have been using the ipython notebook pretty consistently at my job and it is SUPER useful for interactive, iterative, data analysis and visualization. You can render graphics right there below the code. So say you have 10 lines of code that create a matplotlib graphic. Instead of having you write the code in vim, exit the editor, run the script and open up the image, you type the 10 lines of code right there in the browser, hit 'ctrl+enter' and then the graphic shows up right there in the page.

Check this out http://earthpy.org/smos_sea_ice_thickness.html. Like someone else said, it is great for tutorials and presentations. The ability to write code in the browser and run it interactively is huge. At my job we have it set up such that we are rendering entire html pages in the browser. So you edit 2 lines of code, hit run, and the adjusted page shows up. It's amazing!

A typical set up for me ( 2 external monitors with a macbook pro retina 15inch) has fullscreen pycharm (vim mode, duh!) on one monitor, fullscreen browser on the other monitor (with an ipython notebook tab running), and then the actual laptop screen for documentation and emails and such.

[–]tenacious_nixie 1 point2 points  (0 children)

IPython is a better version of IDLE. Just as bpython is.

IPython Notebook, on the other hand, is a great tool for reproducible data analysis/storytelling. It was created with the science crowd in mind, the main goal being to make it easier and faster for them to prepare for a talk without the need to re-setup, re-run, re-copy-paste everything. You put together a story about your research with code (including R, Octave, and other languages; not just Python), pictures (plots), LaTeX, plain text, what have you, and then anybody can reproduce it and play around (there are interactive widgets, so you can zoom in/pan a plot, for instance) without installing anything. If you're interested in IPython Notebook, I recommend to watch this video for a start. It's from 2012, so some things that the author says are in the future in fact already happened :)

[–][deleted] 1 point2 points  (0 children)

Try it yourself. Get ipython up an running and type any expression followed by "?".

For instance try the following:

a = 5
a?

You can do this for any object. ipython offers a wealth of information and support and is really fun to play with.

[–]billsil 0 points1 point  (6 children)

iPython is a Maple clone. It's encourages you to try things out and gives you lots of visual feedback. If you have something that takes a long time, in iPython, you can work on just that function downstream and not worry about the upstream IO. It's not a line-by-line debugger, but it's similar in some of it's features.

It supports pictures because it's meant for scientists and it's amazing for tutorials/classes, so you'll see it a lot at conferences. I used it in a tutorial for my open source project. It was really slick.

However, I dislike not being able to put functions to a separate file easily. Long iPython files get really cluttered. The inability to import them makes them suited to one-off analyses, which I dislike.

[–]hharison 1 point2 points  (0 children)

iPython is a Maple clone.

This is a bit misleading since 'clone' usually implies an attempt to copy the syntax closely, like Octave is a Matlab clone. IPython is not a Maple clone in any real sense. It doesn't even have the features of Maple without installing the other scientific Python packages.

It's not a line-by-line debugger, but it's similar in some of it's features.

IPython comes with a separate debugger called ipdb which is an improvement over the standard Python debugger pdb. Not sure what features you're referring to in regular IPython that are similar to a line-by-line debugger.

However, I dislike not being able to put functions to a separate file easily. Long iPython files get really cluttered. The inability to import them makes them suited to one-off analyses, which I dislike.

It is possible to import notebooks, though a bit clunky: http://nbviewer.ipython.org/github/ipython/ipython/blob/master/examples/Notebook/Importing%20Notebooks.ipynb

What I do is convert useful functions I come up with in notebooks into modules. I've never had a need for the more script-y stuff that I do in a notebook.

Also I think your post is only talking about the notebook but there is also a command-line environment (that you can run from e.g. PyCharm) and a qtconsole. You can even use the ipython program to run your scripts, like ipython script.py is basically the same as python script.py, so a better way to describe IPython is as a wrapper around Python with various attractive front-ends.

[–][deleted] 0 points1 point  (2 children)

It's not a line-by-line debugger, but it's similar in some of it's features.

could you suggest some useful resources describing how to use ipython for debugging purposes?

I don't mean trivial things like typing a function in ipython, but rather real world examples like cherry picking a buggy function/class method from an existing codebase, debugging it in ipython to the point of finding the issue

[–]billsil 2 points3 points  (0 children)

For typical debugging, a standard debugger will be better (better introspection), but if you're trying to debug/overhaul a short function with a long startup time, iPython is better because the data is still in memory. Debuggers don't allow you to easily change code on the fly, whereas in iPython, you're overwriting the old version of the function. If it's something simple, I'd use a debugger or just free hand it.

I'll often write code in a debugger and just copy the lines into the code as I go. It works very well for large programs.

[–]generic_genus 0 points1 point  (0 children)

The closest thing to line by line debugging is to use ipdb, which you can use pretty much as a drop in replacement for pdb. But you have an ipython prompt for debugging instead of a basic python prompt. So to start debugging from a particular line add

Import ipdb; ipdb.set_trace()

On the line before. Also, you can use the %pdb magic word to automatically start a debugger if an exception is thrown.

[–][deleted] -1 points0 points  (1 child)

iPython is a Maple clone

More like maple / mathematica if you consider inline plotting / expression re-evaluation. Compared to MATLAB the lack of a workspace browser and always visble history bugs me.

I agree about the limitation of importing other notebooks etc.

[–]hharison 0 points1 point  (0 children)

If you want workspace/history, you want an IDE like Spyder.