[Tutor] import problem
smichr at bigfoot.com
Tue Apr 19 08:16:07 CEST 2005
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.
print 'y1 executed'
print 'y2 executed'
for f in [y1,y2]:
name = f.__name__
print name; f()
t=timeit.Timer('%s()' % name, 'from __main__ import %s' % name)
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.
More information about the Tutor