On 2/7/2012 1:57 PM, Sarma Tangirala wrote:

Anyway, I was wondering about this, if internally pow() actually uses **. :P

>>> from dis  import dis
>>> dis(lambda a,b:a**b)
  1           0 LOAD_FAST                0 (a)
              3 LOAD_FAST                1 (b)
              6 BINARY_POWER
              7 RETURN_VALUE
>>> dis(lambda a,b:pow(a,b))
  1           0 LOAD_GLOBAL              0 (pow)
              3 LOAD_FAST                0 (a)
              6 LOAD_FAST                1 (b)
              9 CALL_FUNCTION            2
             12 RETURN_VALUE

Now you know, and you know how to find out!

To delve any deeper you'd have to inspect the c source for pow.
I'd assume it uses the c exponent operator

--
Bob Gailer
919-636-4239
Chapel Hill NC

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to