RFC: Proposal: Deterministic Object Destruction
Chris Angelico
rosuav at gmail.com
Thu Mar 1 18:59:11 EST 2018
On Fri, Mar 2, 2018 at 10:38 AM, <ooomzay at gmail.com> wrote:
> def raii_example():
>
> src = RAIIFileAccess("src.txt", 'r')
> dst = RAIIFileAccess("dst.txt", 'w')
>
> for line in src:
> dst.write(line)
>
What happens if we make this change?
def raii_example():
global dst
src = RAIIFileAccess("src.txt", 'r')
dst = RAIIFileAccess("dst.txt", 'w')
for line in src:
dst.write(line)
When does the destination file get closed?
ChrisA
More information about the Python-list
mailing list