+ 5
What is this()? [SOLVED]
What does this() function do? Example: # from math import sqrt as this x = 4 y = 13 print(this(y - x)) Output: 3.0
5 Answers
+ 6
TriXioN
In Python âthisâ is not a built-in method/function.
You would simply write:
print(y -x)
The keyword âthisâ and with Python more often âselfâ is a naming convention used to refer to the current instance of a class object (usually specified as the first arg when defining a class).
However âthisâ in the context above has no meaning and would cause an error.
0
Ohh, sryy, im so potato, in answer i didnt see the line:
Import sqrt from math as this, ohh my gosh,
Im potato
0
Haha, it happens đ
From the sound of it youâve worked it out, but to keep the question/answer correct.
You are using âthisâ as an alias for sqrt from math library.
However, youâve got the import statement the wrong way around:
import sqrt from math as this
Should be:
from math import sqrt as this
0
Bruh