Dick Moores | 12 Jul 15:52

Some starting-out IPython questions

It seems I'm at a disadvantage as a Windows (Win XP Pro) user with
IPython. Some of the features just don't work as described, although
undoubtedly they do on Linux, etc.

To my current puzzlements/questions:

1. If I were using Linux, I suppose my pager would be 'less'. But I'm
not, and it's not. But what is it? And first of all, I want to know
how to go back up a screen or two. To possibly identify the pager, at
the bottom of each screen it says, "---Return to continue, q to
quit---".  Is that 'more'? If so, can I get a version of 'less' that
my IPython could use?

2. I see that timeit can be used this way:
In [22]: timeit x = 2; x**x
10000000 loops, best of 3: 201 ns per loop

But how to use it with, say,

for x in range(1000):
   x**x

3. What does
 ipython  -quick
do?

I found this in my C:\Documents and Settings\Riley\_ipython\ipythonrc.ini:

# quick 1 -> same as ipython -quick
quick 1
(Continue reading)

Jörgen Stenarson | 12 Jul 17:19

Re: Some starting-out IPython questions

Hi Dick,

Dick Moores skrev:
> 
> 4. Although I have the environment variable EDITOR set to Textpad 5,
> ed continues to open IDLE as the editor.
> In [16]: env
> Out[16]:
> ...
>  'EDITOR': "C:\\Program Files\\TextPad 5"
> ...
it looks like you are just pointing to the directory that contains the 
editor and not the actual executable. For me
EDITOR="C:\\program\\textpad 5\\textpad.exe" does the trick.
So you should probably use:
EDITOR="C:\\Program Files\\textpad 5\\textpad.exe"

/Jörgen
Ryan James | 12 Jul 23:09

Re: Some starting-out IPython questions

On Sat, 2008-07-12 at 06:53 -0700, Dick Moores wrote:
> 2. I see that timeit can be used this way:
> In [22]: timeit x = 2; x**x
> 10000000 loops, best of 3: 201 ns per loop
> 
> But how to use it with, say,
> 
> for x in range(1000):
>    x**x
> 

def f():
        for x in range(1000):
                x**x
timeit f()

> 3. What does
>  ipython  -quick
> do?
> 
> I found this in my C:\Documents and Settings\Riley\_ipython\ipythonrc.ini:
> 
> # quick 1 -> same as ipython -quick
> quick 1
> 
> I changed it to 0 to see if I could see the difference. I
> couldn't--possibly because I didn't know what to look for. So, what
> does    ipython -quick   do?
> 

(Continue reading)

Dick Moores | 13 Jul 00:27

Re: Some starting-out IPython questions

On Sat, Jul 12, 2008 at 2:09 PM, Ryan James <rgjames <at> ucdavis.edu> wrote:
> On Sat, 2008-07-12 at 06:53 -0700, Dick Moores wrote:
>> 2. I see that timeit can be used this way:
>> In [22]: timeit x = 2; x**x
>> 10000000 loops, best of 3: 201 ns per loop
>>
>> But how to use it with, say,
>>
>> for x in range(1000):
>>    x**x
>>
>
> def f():
>        for x in range(1000):
>                x**x
> timeit f()

Ah. Nice. But another problem. I can't read the unit of time. See
attached image.

>> 3. What does
>>  ipython  -quick
>> do?
>>
>> I found this in my C:\Documents and Settings\Riley\_ipython\ipythonrc.ini:
>>
>> # quick 1 -> same as ipython -quick
>> quick 1
>>
>> I changed it to 0 to see if I could see the difference. I
(Continue reading)

Fernando Perez | 13 Jul 10:28

Re: Some starting-out IPython questions

On Sat, Jul 12, 2008 at 3:27 PM, Dick Moores <rdmoores <at> gmail.com> wrote:

> Ah. Nice. But another problem. I can't read the unit of time. See
> attached image.

That character is a 'mu' for microseconds.  I don't know why it
doesn't display correctly under windows though.  We could be
mis-encoding it, or it could be a font issue with the windows console.
 Someone more knowledgeable than me on all things win32 may be able to
help here.

Regards,

f
Jörgen Stenarson | 13 Jul 13:50

Re: Some starting-out IPython questions

Fernando Perez skrev:
> On Sat, Jul 12, 2008 at 3:27 PM, Dick Moores <rdmoores <at> gmail.com> wrote:
> 
>> Ah. Nice. But another problem. I can't read the unit of time. See
>> attached image.
> 
> That character is a 'mu' for microseconds.  I don't know why it
> doesn't display correctly under windows though.  We could be
> mis-encoding it, or it could be a font issue with the windows console.
>  Someone more knowledgeable than me on all things win32 may be able to
> help here.
> 
Hi,

I believe the reason is that the reportstring for the timeit magic 
function is built from regular strings and not unicode strings. I have 
attached a patch that works on windows for me.

/Jörgen

=== modified file 'IPython/Magic.py'
--- IPython/Magic.py	2008-07-06 16:54:20 +0000
+++ IPython/Magic.py	2008-07-13 11:45:55 +0000
@@ -1755,7 +1755,7 @@
         import timeit
         import math

-        units = ["s", "ms", "\xc2\xb5s", "ns"]
(Continue reading)

Fernando Perez | 17 Jul 02:38

Re: Some starting-out IPython questions

Hey Jorgen,

On Sun, Jul 13, 2008 at 4:50 AM, Jörgen Stenarson

> I believe the reason is that the reportstring for the timeit magic function
> is built from regular strings and not unicode strings. I have attached a
> patch that works on windows for me.

Thanks!  It seems to also work under *nix, so I'll apply it.  My local
tree will be synced upstream soon.

Cheers,

f

Gmane