On Mar 25, 2:00 pm, Stefan Behnel <stefan...@behnel.de> wrote: > Westley Martínez, 25.03.2011 14:39: > > > On Fri, 2011-03-25 at 07:11 +0100, Stefan Behnel wrote: > >> Steven D'Aprano, 25.03.2011 06:46: > >>> On Thu, 24 Mar 2011 18:32:11 -0700, Carl Banks wrote: > > >>>> It's probably the least justified builtin other than pow. > > >>> I don't know about that. Correctly, efficiently and *quickly* > >>> implementing the three-argument version of pow is exactly the sort of > >>> thing that should be in the built-ins, or at least the standard library. > > >> I think that touches it already. We have a "math" module, so why is there a > >> *builtin* for doing special math? How much code is there really that only > >> uses pow() and does not import "math"? > > > pow() and math.pow() are different. > > I don't find that a good excuse for pow() being a builtin. Why not just > rename it to "math.powmod" instead?
+1 (modulo bikeshedding about the name). I've long thought that three- argument pow belongs in the standard library rather than the core. And then the existence of the ** operator obviates the need for two- argument pow. Worse than pow itself is the fact that the __pow__ special method takes an optional 3rd argument, which apart from unnecessarily complicating Python's internal, also leads to horrors like Decimal's (IMO inappropriate) support for 3-argument pow. -- Mark -- http://mail.python.org/mailman/listinfo/python-list