"ru...@yahoo.com" <ru...@yahoo.com> wrote: > On 06/06/2011 09:29 AM, Steven D'Aprano wrote: >> Yes, but you have to pay the cost of loading the re engine, even if >> it is a one off cost, it's still a cost, > > ~$ time python -c 'pass' > real 0m0.015s > user 0m0.011s > sys 0m0.003s > > ~$ time python -c 'import re' > real 0m0.015s > user 0m0.011s > sys 0m0.003s > > Or do you mean something else by "loading the re engine"?
At least part of the reason that there's no difference there is that the 're' module was imported in both cases: C:\Python27>python -c "import sys; print('re' in sys.modules)" True C:\Python32>python -c "import sys; print('re' in sys.modules)" True Steven is right to assert that there's a cost to loading it, but unless you jump through hoops it's not a cost you can avoid paying and still use Python. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list