4 ms·
> print f"are you {sure} you need parenthesis to call a function in python" This example doesn't call any functions. The print statement was removed in Python
by ptx 3y ago
> print f"are you {sure} you need parenthesis to call a function in python"
This example doesn't call any functions. The print statement was removed in Python 3 and turned into a function, so you do need parentheses to call it and the example above is a syntax error. Python 2 (which had a print statement instead of a print function) didn't support f-strings. And f-strings, unlike JavaScript's template strings, are not function calls.
In other words, yes, you consistently use parentheses to call functions in Python.
- Izkata 3y ago> And f-strings, unlike JavaScript's template strings, are not function calls. IIRC, they're syntactic sugar over "string".format(locals())
- raziel2p 3y agoThey're really not, the internals are different, many features were added. https://docs.python.org/3/library/string.html#format-string-syntax https://docs.python.org/3/library/string.html#format-string-... https://docs.python.org/3/reference/lexical_analysis.html#f-strings https://docs.python.org/3/reference/lexical_analysis.html#f-...
- DangitBobby 3y agoWith the exception of properties, of course.