← Back to team overview

yade-users team mailing list archive

[Question #695676]: How can I use list defined outside, inside the function

 

New question #695676 on Yade:
https://answers.launchpad.net/yade/+question/695676

Hi,

I tried using global in order to use the list defined inside the function,but yade shows error name " " is not defined.
>l = [1,2,3]
>def trail():
   >...:     global l
   >...:     e = len(l)
   >...: trail()

ERROR SHOW IN YADE 
/usr/bin/yade in <module>
      2     global l
      3     e = len(l)
----> 4 trail()

/usr/bin/yade in trail()
      1 def trail():
      2     global l
----> 3     e = len(l)
      4 trail()


I also tried with saveVars I am getting the same error.
Can any one suggest the right way to use the list I defined inside a function.

Regards,
SaiDaka


-- 
You received this question notification because your team yade-users is
an answer contact for Yade.