restriction on sum: intentional bug?
Alan G Isaac
alan.isaac at gmail.com
Sat Oct 17 17:22:11 EDT 2009
On 10/17/2009 7:06 AM, Carl Banks wrote:
> I'm basically saying here is, by shutting out strings from sum,
> you don't really lose much in terms of duck typing, because duck
> typing wouldn't have been that helpful anyway.
That boils down to an argument for type checking
whenever you cannot imagine my use case. I hope
you do not write your own code that way...
Here is a use case you might have ruled out with
that approach. A PyX `path` defines `__add__`
so that paths can be combined as subpaths of a
single path. This is **VERY USEFUL**.
Now if I have a list of paths, it is useful to
to combine them: sum(pathlst,path()).
Alan Isaac
More information about the Python-list
mailing list