Per Erik Strandberg /cv /kurser /blog

I gave IPython a first try today. I really like it.

Here is a typical python session as I might do every day:

$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> l = list()
>>> l.append(3)
>>> l.append(7)
>>> l
[3, 7]
>>> help(l)

>>> type(l)
<type 'list'>
>>> len(l)
2
>>> print l.__doc__
list() -> new empty list
list(iterable) -> new list initialized from iterable's items

This is simplified and enhanced with IPython (see for example [5]. The tab-completion really rocks (see [6]).

$ ipython
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
Type "copyright", "credits" or "license" for more information.

IPython 1.2.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: l = list()

In [2]: l.append(3)

In [3]: l.append(7)

In [4]: l
Out[4]: [3, 7]

In [5]: l?
Type:       list
String Form:[3, 7]
Length:     2
Docstring:
list() -> new empty list
list(iterable) -> new list initialized from iterable's items

In [6]: l2 = li
license  list  

Another nice feature is using Ipython as notebook in a browser:

http://www.pererikstrandberg.se/blog/data-analysis-with-python/ipython-notebook.png


This page belongs in Kategori Programmering
See also Data Analysis With Python