[IPython-User] question about cell magic

Zoltán Vörös zvoros@gmail....
Thu Jun 21 14:03:58 CDT 2012


Hi All,


I would like to ask for some clarification on how the cell magic is supposed to work. The example given in the docs is

%%timeit x = 0   # setup
     for i in range(100000):
         x += i**2

and it does what is expected of it. However, the following won't work

%%timeit
x = 0
for i in range(100000):
     x += i**2


I could bring a couple of arguments why it would be better to have cell magic without the setup statement, but I could also imagine that there is a specific reason for having it like this. In any case, could someone comment on this issue, and if it is not too late before the release, could it be implemented in a way that I indicated?

Cheers,

Zoltán



More information about the IPython-User mailing list