why sqrt is not a built-in function?

Michael F. Stemper mstemper at gmail.com
Fri Jan 15 16:14:26 EST 2021


On 15/01/2021 14.01, Stefan Ram wrote:
> "Michael F. Stemper" <mstemper at gmail.com> writes:

>>                               Of these, only EcmaScript has
>> Math.sqrt() as part of the language, and that could be partly
>> due to the fact that the language doesn't have any concept of
>> "import" or "include".
> 
>    You do not need to use the import statement in Python,
>    but can also use the expression
> 
> __import__( "math" ).sqrt( 4 )

I had no idea that syntax existed, and find it completely at odds
with The Zen of Python. I'm torn between forgetting that I ever saw
it and using it for some evilly-obfuscated code.

I hope that it satisfies the OP.

-- 
Michael F. Stemper
I feel more like I do now than I did when I came in.


More information about the Python-list mailing list