Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.mixmin.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Duncan Booth Newsgroups: comp.lang.python Subject: Re: how to avoid leading white spaces Date: 8 Jun 2011 09:01:48 GMT Lines: 32 Message-ID: References: <9e861b0e-e768-401b-b5ca-190f20830a08@s9g2000yqm.googlegroups.com> <94ph22FrhvU5@mid.individual.net> <4de8eef1$0$29996$c3e8da3$5496439d@news.astraweb.com> <1237a287-10b0-4a2d-ba35-97b5238deda1@n11g2000yqf.googlegroups.com> <4de992d7$0$29996$c3e8da3$5496439d@news.astraweb.com> <4decf252$0$29996$c3e8da3$5496439d@news.astraweb.com> Reply-To: duncan.booth@suttoncourtenay.org.uk Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: individual.net EFztt/Bijaf9wANpYbFg9QPloxUN24+Nct7OK6o/EUmwrNC+xt Cancel-Lock: sha1:uXnRd62E9ArVOF/SMDiGc/Iw40o= User-Agent: Xnews/2006.08.24 Hamster/2.1.0.11 X-Face: .C;/v3#w@2k.C(.1v-}d=`|7AQ-%,#A$0ZGtAkLPvuawAM>3#D,pXaAb31%(=Gn2ZZK/Z~fd0y4't5iKK~F":}F2*|\mQYX+BUr4ZM*|+`@o-TKzFGwsJnan{)*b~QJ-Fu^u'$$nYV Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7224 "rurpy@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