why sqrt is not a built-in function?

Rob Cliffe rob.cliffe at btinternet.com
Thu Jan 14 14:00:20 EST 2021



On 14/01/2021 17:44, Denys Contant wrote:
> I don't understand why sqrt is not a built-in function.
> Why do we have to first import the function from the math module?
> I use it ALL THE TIME!
I agree that, especially if you have experience in other languages, this 
feels odd, and I have some sympathy for you.  I am not sure that I can 
give you a 100% satisfactory answer.
But:
     if the math module should be automatically imported, how many other 
modules that _somebody_ uses "all the time" should also be automatically 
be imported?  Python gives you a light-weight framework (fast to load a 
program) with the option to plug in whichever batteries you need, and 
it's not so terrible to remember to write "import math" or similar, 
especially after the first time.
>
> That felt good. Thank you.
Although I hope you have other ways of venting your frustration than 
shouting at newsgroups.  Perhaps juggling balls?
Best wishes
Rob Cliffe


More information about the Python-list mailing list