restriction on sum: intentional bug?
Carl Banks
pavlovevidence at gmail.com
Mon Oct 19 07:18:06 EDT 2009
On Oct 19, 3:24 am, Tim Chase <python.l... at tim.thechases.com> wrote:
> Carl Banks wrote:
> > Consider this thought experiment:
>
> > class Something(object):
> > def __radd__(self,other):
> > return other + "q"
>
> > x = ["a","b","c",Something()]
>
> > If x were passed to "".join(), it would throw an exception; but if
> > passed to a sum() without any special casing, it would successfully
> > return "abcq".
>
> Okay...this is the best argument I've heard for not using
> "".join() {Awards Carl one (1) internet}
Well that was my argument in the last post you followed up to, I just
used a bad example. Actually this example was described by Dave
Angel, so you should give the internet to him.
Carl Banks
More information about the Python-list
mailing list