Shane Hathaway wrote: > Mike Meyer wrote: > >> Shane Hathaway <[EMAIL PROTECTED]> writes: >> >>> That syntax is verbose and avoided by most coders because of the speed >>> penalty. >> >> What speed penalty? "import re" is a cheap operation, every time but >> the first one in a program. > > I'm talking about using imports *everywhere*. The penalty would be > appreciable.
Have you tried it? D:\Projects\CB>python -m timeit -s "import re" "import re" 1000000 loops, best of 3: 1.36 usec per loop You need a lot of imports before 1 usec becomes "appreciable". And your proposal is doing the import anyway, just under the hood. How will you avoid the same penalty? Kent -- http://mail.python.org/mailman/listinfo/python-list