[mod_python] python print

Scott Russell scott at towngeek.com
Tue Jun 10 10:49:54 EST 2003


Momma always says, "Make sure you can read it first, only optimize it
after you profile." :)

On Tue, 2003-06-10 at 09:35, Jonathan Gardner wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Monday 09 June 2003 12:25, tpc at csua.berkeley.edu wrote:
> > Dear Mr. Russell, thank you I forgot about '+=', which did the trick.
> 
> One more thing I thought you might want to know about. There are really two 
> ways to go about concatenating stuff to the end of strings:
> 
> A)
> 	s = "something"
> 	s += "something more"
> 	...
> 	print s
> 
> B)
> 	s = []
> 	s.append('something')
> 	s.appent('something more')
> 	...
> 	print "".join(s)
> 
> B is far more efficient than A. This really shows up when you are 
> concatenating hundreds or more elements. Anything below that, it really 
> doesn't make too much of a difference.
> 
> - -- 
> Jonathan Gardner <jgardner at jonathangardner.net>
> (was jgardn at alumni.washington.edu)
> Live Free, Use Linux!
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> 
> iD8DBQE+5d6yWgwF3QvpWNwRAuYwAKDA3RK44t5na033XipkR2OrUuYy7gCgsqBj
> oDZOcz6mtB1hiavXnelVodo=
> =oy+6
> -----END PGP SIGNATURE-----
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list