Читать книгу Introduction to Python Programming for Business and Social Science Applications - Frederick Kaefer - Страница 62
Function Location in Code
ОглавлениеWhen Python code is in a text file, you can define functions anywhere within the file and in any order when there are multiple functions. However, it is important that the function definition occurs prior to the use of the function, and so a convention commonly followed when writing Python code is to have all the functions defined at the beginning of the file and, if any executable lines of code in the file are not part of a function, to have those lines of code at the very end.