| 5 | print("refcount of rc_examples", sys.getrefcount(rc_examples)) |
| 6 | |
| 7 | def scope(): |
| 8 | print("rc created") |
| 9 | |
| 10 | rc_a = rc_examples |
| 11 | print("refcount of rc_a", sys.getrefcount(rc_a)) |
| 12 | |
| 13 | def subscope(): |
| 14 | rc_b = rc_a |
| 15 | print("refcount of rc_b", sys.getrefcount(rc_b)) |
| 16 | print("refcount of rc_a", sys.getrefcount(rc_a)) |
| 17 | print("refcount of rc_examples", sys.getrefcount(rc_examples)) |
| 18 | |
| 19 | subscope() |
| 20 | print("refcount of rc_examples after del rc_b", sys.getrefcount(rc_examples)) |
| 21 | |
| 22 | scope() |
| 23 | print("refcount of rc_examples after del rc_a", sys.getrefcount(rc_examples)) |