<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>melpon</author_name>
  <author_url>https://blog.hatena.ne.jp/melpon/</author_url>
  <blog_title>melpon日記 - HaskellもC++もまともに扱えないへたれのページ</blog_title>
  <blog_url>https://melpon.hatenadiary.org/</blog_url>
  <categories>
    <anon>Python</anon>
  </categories>
  <description>この記事は Python Tips Advent Calendar 2012 ６日目の記事です。 Python では、ラムダ式やローカルでの def 関数は、それらを定義した時に、外にあるローカル変数の参照を、ラムダ式や関数のオブジェクトの内部に保存します。 &gt;&gt;&gt; x = 10 &gt;&gt;&gt; f = lambda: x # x をラムダ式オブジェクトに保存する &gt;&gt;&gt; f() # f は x への参照を保持している 10 ローカル変数のコピーではなく &quot;参照&quot; であるという点に注意です。 &gt;&gt;&gt; x = 10 &gt;&gt;&gt; idx = id(x) # ここで使っている x と &gt;&gt;&gt; f = lambd…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmelpon.hatenadiary.org%2Fentry%2F20121206%2F1354636589&quot; title=&quot;外部変数のキャプチャ - melpon日記 - HaskellもC++もまともに扱えないへたれのページ&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>2012-12-06 00:56:29</published>
  <title>外部変数のキャプチャ</title>
  <type>rich</type>
  <url>https://melpon.hatenadiary.org/entry/20121206/1354636589</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
