global
statement detected PYL-W0603 37
38 """
39
40 global BOT_GLOBAL 41 BOT_GLOBAL = bot
42
43 # logging.basicConfig()
129
130
131async def init_client_session():
132 global client_session133 client_session = aiohttp.ClientSession()
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.