how to avoid leading white spaces
Duncan Booth
duncan.booth at invalid.invalid
Wed Jun 8 05:01:48 EDT 2011
"rurpy at yahoo.com" <rurpy at 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
More information about the Python-list
mailing list