yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #04690
[Bug 588387] Re: problem with python globals
phase and refstrain at lines 33 and 34 are local variables, whereas l.
36 creates new global variables of that name. l. 49 refers to local
ones, as per scope search order (local, global, builtin).
** Changed in: yade
Status: New => Invalid
--
problem with python globals
https://bugs.launchpad.net/bugs/588387
You received this bug notification because you are a member of Yade
developers, which is subscribed to Yade.
Status in Yet Another Dynamic Engine: Invalid
Bug description:
As discussed in yade-dev list. Python globals will behave differently if there is a run() in the invoked script or not.
Here is a script. If you run it straightaway, it will print :
"refstrain= 2.0 (should be 2.0), phase= 1 (should be 1)"
Now, comment the two last lines and run it again (clicking "play" for instance, until it stops automatically or as soon as you see "Now εz will go from 0 to .2" output). Typing "print refstrain,phase" will then return : 0.0 0, as if the "global" directive was ignored.
Follow ups
References