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. Not that it matters as I can't see this happening in a month of Sundays.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to