global
statement detected PYL-W060314
15
16def switch():
17 global vulgar_filter18 vulgar_filter = not vulgar_filter
19 return vulgar_filter
20
It is recommended not to use global
statement unless it is really necessary. Global variables are dangerous because they can be simultaneously accessed from multiple sections of a program. This frequently results in bugs. This also make code difficult to read, because they force you to search through multiple functions or even modules just to understand all the different locations where the global variable is used and modified. Read more about why it should be avoided here.