Global variable used to maintain a reference to all event handlers

Global variable used to maintain a reference to all event handlers

YouElz
Contributor Contributor
404 Views
1 Reply
Message 1 of 2

Global variable used to maintain a reference to all event handlers

YouElz
Contributor
Contributor

Hello everyone,

Could someone clarify the necessity of maintaining a global variable to reference all event handlers?

 

I've noticed that all sample programs implement this practice. However, as I'm learning scripting, I haven't encountered any situations where it seems necessary, so I've been writing code without it. Am I overlooking something, or are there specific cases where this would be essential?

 

# Global variable used to maintain a reference to all event handlers.
handlers = []

 

0 Likes
Accepted solutions (1)
405 Views
1 Reply
Reply (1)
Message 2 of 2

kandennti
Mentor
Mentor
Accepted solution
0 Likes