MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / scope

Function scope

10_smart_pointers/python/rc.py:7–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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))

Callers 1

rc.pyFile · 0.85

Calls 2

subscopeFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected