do I have to have main function in my python code? -



do I have to have main function in my python code? -

can write python code bunch of functions without main function. purpose of script other scripts import of functions from. phone call setvar_general.py or imported series of other setvar_x scripts. while these setvar_x more specific things, setvar_general not thing other providing building blocks. hence there not need defining main function in setvar_general.py.

i guess comes downwards question "do have have main function"?

you not have have main function in python , writing separate files without main function, imported other programs, normal , right way of doing python programming.

when python file loaded (either using import or getting executed command line) each statement in programme executed at time. statements def or class statements create function or class definition later use. statements are not within def or class executed right away.

therefore, equivalent of main() function in other languages set of executable statements found in file. if limit these def and/or class statements, effect want.

python main

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -