[Tutor] capitalize() but only first letter

alan.gauld@bt.com alan.gauld@bt.com
Fri Feb 7 06:59:01 2003


> I'm still somewhat confused since I would think that the 
> following tuple uses four throwaway objects 
> 
>     t = ("first", "second", "third")

It does in this case.
But if you used the hard wored stringsa in the join() technique 
they'd also be throwaway there too.

But in this case:

s1 = 'first'
s2 = 'second'
s3 = 'third'
s4 = '%s %s %s' % (s1,s2,s3)

Then only the tuple is temporary, we keep s1,s2,s3 for later use.

but 
s3 = s1 + ' ' + s2 + ' ' + s3

creates 3 temporary strings whilst still keeping s1,s2 and s3.

> notation of object and method calls, so Perl had to use an 
> arrow (->), > which is even uglier than normal Perl code).

In fact I rather like the -> notation for objects, to me it 
is more reminiscent of a message being sent to the object 
than a dot is.

But it's an extra character to typec and bucks the general OO
language trend.

Alan g.