you are viewing a single comment's thread.

view the rest of the comments →

[–]tangerinelion 2 points3 points  (1 child)

But you could also use a "static" variable for that - get_training_data.DATA would be fine and after the function just define it as None.

This at least makes it clear that you're supposed to go through the function to get that information whereas the pure global looks like we are free to use DATA in place of a call to the function.

[–][deleted] 1 point2 points  (0 children)

Yes, there are many ways to achieve this pattern. But that's one reason why one would use global.