<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>lesamoureuses</author_name>
  <author_url>https://blog.hatena.ne.jp/lesamoureuses/</author_url>
  <blog_title>こんにちはこんにちはmonmonです！</blog_title>
  <blog_url>https://monmon.hateblo.jp/</blog_url>
  <categories>
    <anon>python</anon>
  </categories>
  <description>pythonのfor文を使う時に for i in xrange(len(list)): って書き方をすると思うのですが、 len()が毎回実行されたりするのかなぁ？と思って気になりました。 何か関数とかをここで実行した時にパフォーマンスに関わるのかな？という疑問ですね。 確認するためにはfor文の中でlist要素を削除してみて、イテレーションがおかしくなるかどうかを見れば良さそう。 元の要素数分反復していればOKということで以下のように実行。 &gt;&gt;&gt; list = ['a', 'b', 'c', 'd', 'e', 'f'] &gt;&gt;&gt; for i in xrange(len(list)): #…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmonmon.hateblo.jp%2Fentry%2F20110223%2F1298399741&quot; title=&quot;Pythonのfor文のリストの評価は一度だけ - こんにちはこんにちはmonmonです！&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>2011-02-23 03:35:41</published>
  <title>Pythonのfor文のリストの評価は一度だけ</title>
  <type>rich</type>
  <url>https://monmon.hateblo.jp/entry/20110223/1298399741</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
