Jan-09-2024, 09:36 PM
(This post was last modified: Jan-09-2024, 10:12 PM by Yoriz.
Edit Reason: Added code tags
)
Dear Python Community,
I use Python a lot for my company projects, and I ussually do some taslks that seems to
repeats every time. For instance,I use to define vars prior to a loop, so I can use them
a few lines later in the code,
something like:
I feel there could be a better way to handle this. Of course, I am thinking something different
from the global tag, because it is just need in the current variable space.
Can you share your thoughts on this?
Best regars,
Gustavo A. Garcia
Gibgo
I use Python a lot for my company projects, and I ussually do some taslks that seems to
repeats every time. For instance,I use to define vars prior to a loop, so I can use them
a few lines later in the code,
something like:
1 2 3 4 |
result = None if cond_x = = 'x' : result = .... print (result) |
from the global tag, because it is just need in the current variable space.
Can you share your thoughts on this?
Best regars,
Gustavo A. Garcia
Gibgo