[Tutor] capitalize() but only first letter

Erik Price erikprice@mac.com
Wed Feb 5 22:41:01 2003


On Wednesday, February 5, 2003, at 10:31  PM, Jeff Shannon wrote:

> I suspect that Sean finds the string method syntax of join() to be 
> awkward (there was quite a bit of discussion when this was added to 
> Python, and many people still disagree with Guido's decision), but I 
> find it less awkward than needlessly importing the string module.  ;)

I also prefer to use methods of objects rather than pass objects to 
functions, but it seems like six on one side, half a dozen on the 
other.  I find methods a little simpler.  (This actually raises another 
question that I wanted to ask, but it's so unrelated to this thread 
that I'll spawn a new one.)

>> Finally, how does this compare:
>>
>> print("%s %s") % ('hello', 'world')
>
>
> This is much preferable, at least to my tastes.  It still avoids the 
> creating of multiple intermediate strings

Let me just play devil's advocate here then, because I'm a little 
confused -- if it avoids creating multiple intermediate strings, then 
what would those elements of the tuple be?  They are not references to 
string objects?  (I sound obstinate here but I'm trying to be curious.)

> There are only three situations where I find the append()/join() 
> method preferable to this

All very good points, thank you.


Erik





-- 
Erik Price

email: erikprice@mac.com
jabber: erikprice@jabber.org