sum and strings

Paddy paddy3118 at netscape.net
Fri Aug 18 21:59:05 EDT 2006


Georg Brandl wrote:
> Paddy wrote:
<<SNIP>>
> > I get where you are coming from, but in this case we have a function,
> > sum, that is not as geeral as it could be. sum is already here, and
> > works for some types but not for strings which seems an arbitrary
> > limitation that impede duck typing.
>
> Only that it isn't arbitrary.
Hi Georg,
I said it *seemed* arbitrary. I doubt that it is arbitrary, and thought
someone would say why the restriction is necessary.

>
> > - Pad.
> >
> > P.S. I can see why, and am used to the ''.join method. A newbie
> > introduced to sum for integers might naturally try and concatenate
> > strings using sum too.
>
> Yes, and he's immediately told what to do instead.
Yep, thats the what. Now as to the why?

- paddy.




More information about the Python-list mailing list