Why is pow a builtin, anyways?

Carl Banks pavlovevidence at gmail.com
Thu Jan 4 12:09:14 EST 2007


siggi wrote:
> Now the test for module math with function pow():
> ---------------------------------------------------
> >>> pow(9,9)
> 387420489
>
>  Fine, but sqrt() fails:
> -------------------
> >>> sqrt(9)
> I get this error message
>
> 'Traceback (most recent call last):
>   File "<pyshell#3>", line 1, in <module>
>     sqrt(9)
> NameError: name 'sqrt' is not defined'

The third argument to the builtin pow is a special usage for
cryptography, and something specific like that needs no representation
in the builtin namespace.  The ** operator covers all other uses.


Carl Banks




More information about the Python-list mailing list