<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>griefworker</author_name>
  <author_url>https://blog.hatena.ne.jp/griefworker/</author_url>
  <blog_title>present</blog_title>
  <blog_url>https://tnakamura.hatenablog.com/</blog_url>
  <categories>
    <anon>C#</anon>
    <anon>Python</anon>
  </categories>
  <description>Python のサンプルコードで、よく次のような書き方を見かけます。 [f(x) for x in col] この書き方、「リスト内包表現」と呼びます。これを初めて見たとき、私は何をやっているのか全く分かりませんでした。調べてみると、どうやら次の処理を行うようです。 col の各要素を x に代入 f(x) を評価 f(x) の結果を集めた配列を返す C# で同じ処理をするなら、次のように書けます。 col.Select(x =&gt; f(x)); 左から右に読めるぶん、こちらが分かりやすい。慣れもあるでしょうがｗこのリスト内包表現、次のように書けば、集める要素を絞り込めます。 [f(x) for…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftnakamura.hatenablog.com%2Fentry%2F20091021%2Flist_comprehension&quot; title=&quot;リスト内包表現 - present&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>2009-10-21 00:00:00</published>
  <title>リスト内包表現</title>
  <type>rich</type>
  <url>https://tnakamura.hatenablog.com/entry/20091021/list_comprehension</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
