On Friday, 2 March 2018 15:37:25 UTC, Paul Moore wrote:
[snip]
> def fn():
> for i in range(10000):
> with open(f"file{i}.txt", "w") as f:
> f.write("Some text")
>
> How would you write this in your RAII style - without leaving 10,000
> file descriptors open until the end of the function?
def fn():
for i in range(10000):
f = RAIIFile(f"file{i}.txt", "w")
f.write("Some text")
--
https://mail.python.org/mailman/listinfo/python-list
- Re: RFC: Proposal: Deterministic Object Destruction Chris Angelico
- Re: RFC: Proposal: Deterministic Object Destruction ooomzay
- Re: RFC: Proposal: Deterministic Object Destruction ooomzay
- Re: RFC: Proposal: Deterministic Object Destruction ooomzay
- Re: RFC: Proposal: Deterministic Object Destruction Paul Moore
- Re: RFC: Proposal: Deterministic Object Destruction Michael Torrie
- Re: RFC: Proposal: Deterministic Object Destruction Chris Angelico
- Re: RFC: Proposal: Deterministic Object Destruction Ned Batchelder
- Re: RFC: Proposal: Deterministic Object Destruction Ooomzay
- Re: RFC: Proposal: Deterministic Object Destruction ooomzay
- Re: RFC: Proposal: Deterministic Object Destruction Ooomzay
- Re: RFC: Proposal: Deterministic Object Destruction Mark Lawrence
- Re: RFC: Proposal: Deterministic Object Destruction Ooomzay
- Re: RFC: Proposal: Deterministic Object Destruction Mark Lawrence
- Re: RFC: Proposal: Deterministic Object Destruction Ooomzay
- Re: RFC: Proposal: Deterministic Object Destruction Ooomzay
- Re: RFC: Proposal: Deterministic Object Destruction Steven D'Aprano
- Re: RFC: Proposal: Deterministic Object Destruction ooomzay
- Re: RFC: Proposal: Deterministic Object Destruction Michael Torrie
- Re: RFC: Proposal: Deterministic Object Destruction Richard Damon
- Re: RFC: Proposal: Deterministic Object Destruction Chris Angelico
