A super detailed tutorial: springboot integrates mybatis plus>>>
When the module variable is assigned in def, it will be reported as follows: Shadows name ‘xxx’ from outside scope
In this case, you need to reference module variables through global declaration in def
For example
level = 0 def test(): global level level += 1
Python variable scope:
module corresponds to global,
the innermost layer is local,
the outer layer is nonlocal
variable search order: inner scope – > Outer layer – > Global – > Builtin
only class, def and lamda can change the scope