[mod_python] python print

Jonathan Gardner jgardner at jonathangardner.net
Tue Jun 10 06:35:43 EST 2003


-----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-----



More information about the Mod_python mailing list