Re: why sqrt is not a built-in function?

2021-01-16 Thread Michael F. Stemper
On 15/01/2021 17.17, dn wrote: On 16/01/2021 11.40, Michael F. Stemper wrote: On 15/01/2021 16.01, Chris Angelico wrote: On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper wrote: On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: On 15/01/2021 14.01, Stefan Ram wrote: _

Re: why sqrt is not a built-in function?

2021-01-15 Thread Greg Ewing
On 16/01/21 10:14 am, Michael F. Stemper wrote: I had no idea that syntax existed, and find it completely at odds with The Zen of Python. It's not an *obvious* way, so there's no Zen conflict. As for why it exists, it's part of the mechanism that implements imports -- 'import' statements get c

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 10:18 AM dn via Python-list wrote: > >> I am confuzzed. > > > > It's a common condition. > > There are three components: > 1 From the Greek: "con" meaning 'against' or 'unable'. > 2 From tech-jargon (and the Australian habit of shortening every word in > the English languag

Re: why sqrt is not a built-in function?

2021-01-15 Thread dn via Python-list
On 16/01/2021 11.40, Michael F. Stemper wrote: > On 15/01/2021 16.01, Chris Angelico wrote: >> On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper >> wrote: >>> >>> On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: > On 15/01/2021 14.01, Stefan Ram wrote: > >> __imp

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 9:47 AM Michael F. Stemper wrote: > > On 15/01/2021 16.01, Chris Angelico wrote: > > On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper > > wrote: > >> > >> On 15/01/2021 15.26, Stefan Ram wrote: > >>> "Michael F. Stemper" writes: > On 15/01/2021 14.01, Stefan Ram w

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 16.01, Chris Angelico wrote: On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper wrote: On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: On 15/01/2021 14.01, Stefan Ram wrote: __import__( "math" ).sqrt( 4 ) I had no idea that syntax existed, and find it c

Re: why sqrt is not a built-in function?

2021-01-15 Thread dn via Python-list
On 15/01/2021 06.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! > > That felt good. Thank you. Are you 'venting', or do you have

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 9:25 AM Eli the Bearded <*@eli.users.panix.com> wrote: > > In comp.lang.python, Chris Angelico wrote: > > Michael F. Stemper wrote: > >> On 15/01/2021 14.01, Stefan Ram wrote: > >>> __import__( "math" ).sqrt( 4 ) > >> I had no idea that syntax existed, and find it complet

Re: why sqrt is not a built-in function?

2021-01-15 Thread Eli the Bearded
In comp.lang.python, Chris Angelico wrote: > Michael F. Stemper wrote: >> On 15/01/2021 14.01, Stefan Ram wrote: >>> __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 an

Re: why sqrt is not a built-in function?

2021-01-15 Thread dn via Python-list
On 16/01/2021 10.49, Michael F. Stemper wrote: ... > Es ist Feierabend You had me there for a moment, because spotting a 'double meaning" (actually triple) my mind succumbing to dissonance, refused to translate (into English), instead latching onto the last two syllables:- At one time, tech-jar

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper wrote: > > On 15/01/2021 15.26, Stefan Ram wrote: > > "Michael F. Stemper" writes: > >> On 15/01/2021 14.01, Stefan Ram wrote: > >>> __import__( "math" ).sqrt( 4 ) > >> I had no idea that syntax existed, and find it completely at odds > >> with T

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: On 15/01/2021 14.01, Stefan Ram wrote: __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 s

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 8:16 AM Michael F. Stemper wrote: > > On 15/01/2021 14.01, Stefan Ram wrote: > > "Michael F. Stemper" writes: > > >> Of these, only EcmaScript has > >> Math.sqrt() as part of the language, and that could be partly > >> due to the fact that the

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.01, Stefan Ram wrote: "Michael F. Stemper" 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 ne

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 7:45 AM Michael F. Stemper wrote: > > Languages differ. I don't see why it's so important to focus on just > > one thing - and to complain that, even though it's in the standard > > library, you have to use an import command to get it. > > You should probably direct this to

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.02, Chris Angelico wrote: On Sat, Jan 16, 2021 at 6:21 AM Michael F. Stemper wrote: Here's the status of the square root function in various languages, in the order that I encountered them: FORTRANPart of the language Pascal Part of the language SNOBOL Part of the

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Green
Michael F. Stemper wrote: > On 14/01/2021 13.00, Rob Cliffe wrote: > > 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? > >

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.00, Chris Green wrote: Michael F. Stemper wrote: On 14/01/2021 13.00, Rob Cliffe wrote: 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

Re: why sqrt is not a built-in function?

2021-01-15 Thread Chris Angelico
On Sat, Jan 16, 2021 at 6:21 AM Michael F. Stemper wrote: > Here's the status of the square root function in various languages, > in the order that I encountered them: > > FORTRANPart of the language > Pascal Part of the language > SNOBOL Part of the language > c Need to #incl

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 14/01/2021 13.00, Rob Cliffe wrote: 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 lang

Re: why sqrt is not a built-in function?

2021-01-15 Thread Rob Cliffe via Python-list
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

Re: why sqrt is not a built-in function?

2021-01-14 Thread Greg Ewing
Aother thing to consider is that math.sqrt is not the only sqrt function in Python. There is also one in cmath, and in the wider ecosystem, another one in numpy. Being explicit about which one you're using is a good thing. Concerning exponentiation, it can be used to achieve the same thing as sqr

Re: why sqrt is not a built-in function?

2021-01-14 Thread Eli the Bearded
In comp.lang.python, Ethan Furman wrote: > On 1/14/21 11:06 AM, Eli the Bearded wrote: >> "There should be one-- and preferably only one --obvious way to do it." >> Plus the ** operation ("root = x ** 0.5"), that's now three ways. > Yes, but which of those is obvious? If it's up to me, the ** on

RE: why sqrt is not a built-in function?

2021-01-14 Thread Avi Gross via Python-list
importing that and waiting as they all load. -Original Message- From: Python-list On Behalf Of Ethan Furman Sent: Thursday, January 14, 2021 2:36 PM To: python-list@python.org Subject: Re: why sqrt is not a built-in function? On 1/14/21 11:06 AM, Eli the Bearded wrote: > "There shoul

Re: why sqrt is not a built-in function?

2021-01-14 Thread Ethan Furman
On 1/14/21 11:06 AM, Eli the Bearded wrote: "There should be one-- and preferably only one --obvious way to do it." Meanwhile, Alan Gauld pointed out: AG> because pow() is a builtin function and AG> root = pow(x,0.5) AG> is the same as AG> root = math.sqrt(x) Plus the ** operation

Re: why sqrt is not a built-in function?

2021-01-14 Thread Chris Angelico
On Fri, Jan 15, 2021 at 6:11 AM Eli the Bearded <*@eli.users.panix.com> wrote: > > In comp.lang.python, Skip Montanaro wrote: > > Finally, should have never considered it, I think you might want to > > study the output of > > > > import this > > > > Think on the second and last lines in particula

Re: why sqrt is not a built-in function?

2021-01-14 Thread Eli the Bearded
In comp.lang.python, Skip Montanaro wrote: > Finally, should have never considered it, I think you might want to > study the output of > > import this > > Think on the second and last lines in particular. >>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly.

Re: why sqrt is not a built-in function?

2021-01-14 Thread Chris Angelico
On Fri, Jan 15, 2021 at 5:56 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2021-01-14 at 17:54:55 +, > Alan Gauld via Python-list wrote: > > > My question is: why do we even have a sqrt() in the > > math module given that pow() and ** are already there? > > Probably because the standar

Re: why sqrt is not a built-in function?

2021-01-14 Thread 2QdxY4RzWzUUiLuE
On 2021-01-14 at 17:54:55 +, Alan Gauld via Python-list wrote: > My question is: why do we even have a sqrt() in the > math module given that pow() and ** are already there? Probably because the standard C math library has such a function, and Python's math module is (or at least was) suppos

Re: why sqrt is not a built-in function?

2021-01-14 Thread Ethan Furman
On 1/14/21 9:44 AM, 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! And thousands, tens of thousands, and maybe hundreds of thousands don't. That felt good. Thank

Re: why sqrt is not a built-in function?

2021-01-14 Thread Alan Gauld via Python-list
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! because pow() is a builtin function and root = pow(x,0.5) is the same as root = math.

Re: why sqrt is not a built-in function?

2021-01-14 Thread Skip Montanaro
> 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! For one, it's specific to numeric types. You might use it all the time, but I (for example) almost never need to use it, or

Re: why sqrt is not a built-in function?

2021-01-14 Thread jak
Il 14/01/2021 18:44, Denys Contant ha scritto: 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! That felt good. Thank you. >>> val=16 >>> exp=2 >>>

why sqrt is not a built-in function?

2021-01-14 Thread Denys Contant
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! That felt good. Thank you. -- https://mail.python.org/mailman/listinfo/python-list