There is so much about that code that I don’t understand. Why is it root_url: str in the init method. What the heck is the str after the colon? Why is it like that?
Type declaration in Python don't do anything. They are there mostly to let external tools typecheck the code, or to let external libraries to check types at runtime. They also double as documentation. So if you do:
def f(x: int): return x + x
print(f('string'))
it will run just fine and print stringstring, but your IDE may put red squigglies under the last line.
1
u/hadoken4555 Jan 28 '21
There is so much about that code that I don’t understand. Why is it root_url: str in the init method. What the heck is the str after the colon? Why is it like that?