Python Forum
placing module level statements into def
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
placing module level statements into def
#1
I have my own flowchart GUI for C++ that I'm extending to python and have a question about python statements that exist at module level i.e. they are outside of a def statement.

#module level statements, simple example
print(123)
The flowchart tool can handle statements that exist within def (because it can already handle C++ statements between braces{}), so I'm considering automatically wrapping module level statements into a pre-named def called "initialization".

#module initialization, wrapping commands into a def
def initialization():
    print(123)
initialization()
I'm not sure about the kind of issues I would have if I automatically wrapped such statements. Can anyone with python experience suggest any issues that may occur if I took this approach? I can then look at how the python is reverse engineered into the GUI and handle any such issues..

Thanks in advance
Reply


Messages In This Thread
placing module level statements into def - by michaelcollier - Apr-28-2017, 07:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Placing directory in a function mmaz67 3 2,968 Jul-04-2018, 09:20 AM
Last Post: volcano63

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020