Dave Angel
Tue, 07 Feb 2012 11:12:38 -0800
On 02/07/2012 01:57 PM, Sarma Tangirala wrote:
I have no idea, but I'd assume so, unless there's a 3rd argument. At that point, the algorithm must change drastically.On 8 February 2012 00:01, Steven D'Aprano<st...@pearwood.info> wrote:Sarma Tangirala wrote: Is is better to use pow() against **? Advantages of ** - it is shorter to type x**y vs pow(x, y) - being an operator, it is slightly faster than calling a function - you can't monkey-patch it Disadvantages of ** - being an operator, you can't directly use it as a function-object - it can't take three arguments - hard to google for "**" - you can't monkey-patch it Advantages of pow() - it is a function, so you can pass it around as an object - three argument form - easy to call help(pow) to see documentation - easy to google for "pow" - can be monkey-patched Disadvantages of pow() - a tiny bit slower due to the function call - slightly longer to type - can be monkey-patched Weigh up the advantages and disadvantages of each, and make the call which is better for you. (My preference is to use the ** operator.)A simple "function call" argument would have done! :D Thanks for the survey! Anyway, I was wondering about this, if internally pow() actually uses **. :P
-- DaveA _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor