I need to have a flag named DEBUG
which when set to True
will skip some part of the code which are not required for the simulation.
I thought of having the flag passed as an argument, and @cfelton pointed out that it might become cumbersome to pass the flag through the hierarchy till the lowest module. It will be easy for someone using these modules to just add an extra argument for this flag.
Or is there any other better way to do this?
from the manual, page 66:
For some tasks, such as debugging, it may be useful to insert arbitrary Python code that should not be converted.
The convertor supports this by ignoring all code that is embedded in a ```if debugtest._ _The value of the
debug``` variable is not taken into account.
Thanks
I think this is a different type of debug, where you want a different set of parameters for simulation (e.g. no 2 second delay). Debug might not be the best description.
This flag/parameter is intended to be used in conversion but a different configuration for some simulation tests. In otherwords, here is no chuck of code to exclude from conversion
For the discussion, let’s say there is a subblock buried in the hierarchy that, for some reasons, needs a 10 second delay before the subblock does anything. In the physical system this is an absolute requirement but for simulation this is not needed. What would be a reasonable method to change the subblock parameter? Pass it down through the hierarchy? Use a global setting? Other options?
The above is just an example, not the @sriramesh4’s specific issue.
Note to all GSoC students. More time needs to be taken to craft useful questions and descriptions of an issue. The problem / issue needs to be fully described with possible examples (digestible examples, not a dump of debug my code) and things that you have tried. If you are unsure what you are trying to ask about just start with something simple. Not everyone that is available to provide feedback and assistance is intimately familiar with the project or a particular problem.
@cfelton I used the __debug__
variable for this and it seems to be fine for my requirement. In this place I wanted to make the variable i_am_ready
to True irrespective of the other conditions during simulation, since there will not be any errors due to transmission during simulation. By using __debug__
i was able to do it.
As you said this is ideal for excluding some code during conversion, Again I don’t know whether this is the right way to do it for this specific issue?