Lawrence D'Oliveiro <l...@geek-central.gen.new_zealand> writes: > [Reference counting] avoids the need for garbage collection. It means > I can write things like > > contents = open(filename, "r").read() > > and know the file object will be immediately closed after its contents > are returned.
Not quite; it means you know that the object *becomes a candidate* for cleanup immediately after its contents are returned. When, or whether, that cleanup actually happens is not something that is necessarily promised by a reference-counting implementation. -- \ “I tell you the truth: some standing here will not taste death | `\ before they see the Son of Man coming in his kingdom.” —Jesus | _o__) Christ, c. 30 CE, as quoted in Matthew 16:28 | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list