<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>thr3a</author_name>
  <author_url>https://blog.hatena.ne.jp/thr3a/</author_url>
  <blog_title>動かざることバグの如し</blog_title>
  <blog_url>https://blog.turai.work/</blog_url>
  <categories>
    <anon>python</anon>
  </categories>
  <description>結論 できない。PythonはRubyのように条件式を行末に記述する「倒置if」をサポートしていない。 例えば &gt;&gt;&gt; print('hello') if (2 &gt; 1) を実行してもシンタックスエラーになる。 が、しかし それだけだと１行で終わってしまうので。リストと呼ばれるいわゆる配列の中では使える。以下は例 &gt;&gt;&gt; array = [1,2,3,4,5] &gt;&gt;&gt; array2 = [num for num in array if num &gt; 2] &gt;&gt;&gt; print(array2) [3, 4, 5] 正直いうほど見やすいか？？</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.turai.work%2Fentry%2F20170730%2F1501392369&quot; title=&quot;pythonで倒置ifを使いたい - 動かざることバグの如し&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>2017-07-30 14:26:09</published>
  <title>pythonで倒置ifを使いたい</title>
  <type>rich</type>
  <url>https://blog.turai.work/entry/20170730/1501392369</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
