On 05/03/18 01:01, Ooomzay wrote:
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?


Sure, when you state what you intend doing about reference cycles, which you've been asked about countless times.

--
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