<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>michisu</author_name>
  <author_url>https://blog.hatena.ne.jp/michisu/</author_url>
  <blog_title>from __future__ import nowhere @ はてな</blog_title>
  <blog_url>https://michisu.hatenadiary.org/</blog_url>
  <categories>
    <anon>Python</anon>
  </categories>
  <description>&quot;Python does not make any guarantee at all about *when* the destructor will be called.&quot;というわけで、__del__に書いたコードが想定どおりに動かないケースが紹介されている。 で終了時に確実にインスタンスの後かたづけをするためのレシピ。AutoCloseクラスを継承したクラスを作ってcloseメソッドを実装しておくと、Pythonが終了する時にAutoCloseのクラスメソッドcloseallが呼び出されて、生成した全てのインスタンスのcloseメソッドが実行される。調べたこと。 typeを継承 __met…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmichisu.hatenadiary.org%2Fentry%2F20070702%2Fp2&quot; title=&quot;ASPN : Python Cookbook : Semi-automatic resource management with AutoClose - from __future__ import nowhere @ はてな&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2007-07-02 00:00:01</published>
  <title>ASPN : Python Cookbook : Semi-automatic resource management with AutoClose</title>
  <type>rich</type>
  <url>https://michisu.hatenadiary.org/entry/20070702/p2</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
