I sent the following to the mac-sig without reply (except for an autoresponder telling me that a person was out of the office :-)). Is there anyone with a mac that could test this code in the IDE to see if you have the same problems? (I don't have problems running it through the 2.4 version of python in the terminal.)

=====

I was recently trying to use the timeit module and although I was able to do so without problem on a Windows machine, I get a "cannot import y1" ImportError from the following script.

###
import timeit
def y1():
        print 'y1 executed'
def y2():
        print 'y2 executed'
for f in [y1,y2]:
        name = f.__name__
        print name; f()
        t=timeit.Timer('%s()' % name, 'from __main__ import %s' % name)
        print t.timeit(1)
###
--the output--
y1
y1 executed
** ImportError

I am using the IDE for 2.3.3 under OS X (10.2.8).

I am able to successfully run timeit in other ways, but I like the above way to loop through the codes that I want to test.

/c

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to