On Sunday, 4 March 2018 23:57:24 UTC, Mark Lawrence wrote: > On 04/03/18 02:28, Ooomzay wrote: > > 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") > >
> Over my dead body. Care to expand on that? -- https://mail.python.org/mailman/listinfo/python-list