In article <c937b19b-9fed-415f-85b1-4c2c86e15...@gmail.com>, Rafael Bejarano <beja...@gmail.com> wrote: > I can't get the clock() function in the time module to work. I would > appreciate any helpful suggestions. > > Below is a copy of the Terminal session, for your perusal. > > Thanks. > Rafael Bejarano > > Last login: Mon Feb 21 13:02:48 on ttyp1 > Welcome to Darwin! > 173-216-77-254-arka:~ Rafael$ python > Python 3.0.1 (r301:69597, Feb 14 2009, 19:03:52) > [GCC 4.0.1 (Apple Inc. build 5490)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import time > >>> clock() > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > NameError: name 'clock' is not defined > >>>
Importing a module creates a new namespace for the names in that module.: $ python3.2 Python 3.2 (r32:88452, Feb 20 2011, 11:12:31) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> time.clock() 0.091744 You might want to review the Python tutorial here: http://docs.python.org/py3k/tutorial/index.html And, by the way, you should upgrade to Python 3.2 as soon as possible. Python 3.0.1 was a very early release of Python 3. It is known to be buggy and is no longer supported. -- Ned Deily, n...@acm.org _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG