(Jan-11-2017, 10:45 PM)snippsat Wrote: Using global I can simplify my code and avoid atributions errors.OK, thanks for the help.
No,that not an excuse at all for using stupid global.
global destroy the whole point of functions,
which is keeping code local to function and not mix in with stuff in global namespace.
If it to difficult with function,using class is the next step.
Globals are really common in MatLab and I wondering if in Python exist similar way to work with that.
As I can see, your suggestion is to work with functions like in C. It's a little bit more complicate to adapt my program, but I want to use Python, so I will try.
(Jan-11-2017, 10:53 PM)micseydel Wrote: @Felipe: you don't need the global keyword for that example, and I'm no expert on that keyword but I think it just makes it global to the file, no farther. You can simply import the variable into the other file (again, no need for the global keyword).
Oh, really, only for the file?
You can give me a short example from what you mean with "import the variable into the other file"? It's different from use arguments into functions?
Thanks.