string object methods vs string module functions

David Bolen db3l at fitlinxx.com
Tue Oct 23 21:11:19 EDT 2001


"Emile van Sebille" <emile at fenx.com> writes:

> take from string.py, showing ''.join and string.join() are the same:

Well, the eventually execute the same underlying code, but the string
module functions do more work along the way.  For example, an extra
string object is created (or in the default case the existing default
object is used), and there is an extra function call along the way.

Whether or not this extra layer is significant probably depends
heavily on how the methods are used by a piece of code and how deeply
embedded in critical loops or code paths they are.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list