from dis import dis
def fstr_(number):
return f"{number}"
def str_(number):
return str(number)
print("=== fstring ===")
dis(fstr_)
print("=== str() ===")
dis(str_)
=== fstring===
5 0 LOAD_FAST 0 (number)
2 FORMAT_VALUE 0
4 RETURN_VALUE
===str()===
9 0 LOAD_GLOBAL 0 (str)
2 LOAD_FAST 0 (number)
4 CALL_FUNCTION 1
6 RETURN_VALUE
Python
hakkında diğer konular