What's so wrong about execfile?

2009-02-27 Thread Sammo
Given that execfile has been removed in py3k, I want to understand exactly why. Okay, I get that execfile is bad from the following thread: On Jul 29 2007, 2:39 pm, Steven D'Aprano wrote: > (1) Don't use eval, exec or execfile. > > (2) If you're an expert, don't use eval, exec or execfile. > > (

Re: String concatenation performance with +=

2009-02-14 Thread Sammo
On Feb 14, 5:33 pm, Steven D'Aprano wrote: > > AFAIK, using list mutation and "".join only improves performance if > > the "".join is executed outside of the loop. > > Naturally. If you needlessly join over and over again, instead of delaying > until the end, then you might as well do string conca

Re: String concatenation performance with +=

2009-02-14 Thread Sammo
On Feb 14, 4:47 pm, Steven D'Aprano wrote: > > Sammo gmail.com> writes: > >> String concatenation has been optimized since 2.3, so using += should > >> be fairly fast. > > > This is implementation dependent and shouldn't be relied upon. > > It

Re: String concatenation performance with +=

2009-02-13 Thread Sammo
0+ ms) On Feb 14, 3:12 pm, Benjamin Peterson wrote: > Sammo gmail.com> writes: > > > String concatenation has been optimized since 2.3, so using += should > > be fairly fast. > > This is implementation dependent and shouldn't be relied upon. > > > Note tha

String concatenation performance with +=

2009-02-13 Thread Sammo
String concatenation has been optimized since 2.3, so using += should be fairly fast. In my first test, I tried concatentating a 4096 byte string 1000 times in the following code, and the result was indeed very fast (12.352 ms on my machine). import time t = time.time() mydata = "" moredata = "A"