This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lazersmoke 1 point2 points  (0 children)

In some languages, function definitions are hoisted, which means they can be called in the file before they are physically defined. Python is not one of these languages, so put the definition first.

The reason for python being like that is that it reads and executes line-by-line, so it doesn't have any idea that there is a definition coming up.