+ 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 ответов
+ 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