| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # A201 | |
| 2 global a | |
| 3 a = 1 | |
| 4 | |
| 5 | |
| 6 class Foo: | |
| 7 global a | |
| 8 # A201 | |
| 9 global a, b | |
| 10 a = 2 | |
| 11 b = 3 | |
| 12 | |
| 13 def foo(self): | |
| 14 # A201 | |
| 15 global b, c | |
| 16 b = 4 | |
| 17 | |
| 18 | |
| 19 math = None | |
| 20 Class = None | |
| 21 func = None | |
| 22 | |
| 23 | |
| 24 def lazy_import(): | |
| 25 global math | |
| 26 if math is None: | |
| 27 import math | |
| 28 return math | |
| 29 | |
| 30 | |
| 31 def lacy_class(): | |
| 32 global Class | |
| 33 if Class is None: | |
| 34 class Class: | |
| 35 pass | |
| 36 return Class | |
| 37 | |
| 38 | |
| 39 def lazy_function(): | |
| 40 global func | |
| 41 if func is None: | |
| 42 def func(): | |
| 43 pass | |
| 44 return func | |
| OLD | NEW |