On May 27, 11:07 pm, Steven D'Aprano <st...@remove-this- cybersource.com.au> wrote: > On Wed, 27 May 2009 12:58:02 +0000, Albert van der Horst wrote: > > >>And how is reduce() supposed to know whether or not some arbitrary > >>function is commutative? > > > Why would it or need it? A Python that understands the ``par'' keyword > > is supposed to know it can play some tricks with optimizing reduce() if > > the specific function is commutative. > > Fine. Move the smarts out of reduce() into the compiler. How is the > compiler supposed to know if an arbitrary function is commutative?
Unit testing. -- http://mail.python.org/mailman/listinfo/python-list