I am a Java programmer making his way into Python, and some things are just baffling. For example, adding variables to functions, dynamically. For example:
def main():
print ("Hello World")
main.temp = 50
print (main.temp)
What does that even mean? Why would you want to add a variable to a function? Why is that allowed? And why am I allowed to reference the function via main.temp
?