Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Szabolcs Horvát
Gabriel Genellina wrote: Python doesn't require __add__ to be associative, so this should not be used as a general sum replacement. It does not _require_ this, but using an __add__ that is not commutative and associative, or has side effects, would qualify as a serious misuse, anyway. So I

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-05 Thread Szabolcs Horvát
Duncan Booth wrote: Szabolcs Horvát <[EMAIL PROTECTED]> wrote: I thought that it would be very nice if the built-in sum() function used this algorithm by default. Has this been brought up before? Would this have any disadvantages (apart from a slight performance impact, but Pytho

Re: Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-03 Thread Szabolcs Horvát
Arnaud Delobelle wrote: sum() works for any sequence of objects with an __add__ method, not just floats! Your algorithm is specific to floats. This occurred to me also, but then I tried sum(['abc', 'efg'], '') and it did not work. Or is this just a special exception to prevent the misuse

Feature suggestion: sum() ought to use a compensated summation algorithm

2008-05-03 Thread Szabolcs Horvát
data)/len(data) I thought that it would be very nice if the built-in sum() function used this algorithm by default. Has this been brought up before? Would this have any disadvantages (apart from a slight performance impact, but Python is a high-level language anyway ...)? Sza

Re: pythonesque constructs for c++

2007-09-12 Thread Szabolcs Horvát
Josh wrote: > One of the best features of python is its ease of use, and the ease of use > of its modules. Modules like os, os.path, and datetime are invaluable! > > Does anyone know of analagous c++ libraries? It seems to me that most of the > functionality of these modules could easily be repl