<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>a666666</author_name>
  <author_url>https://blog.hatena.ne.jp/a666666/</author_url>
  <blog_title>@kyanny's blog</blog_title>
  <blog_url>https://blog.kyanny.me/</blog_url>
  <categories>
  </categories>
  <description>Ruby で書くとき、非常によく使う syntax の一つ。 str = open('/etc/hosts').read if m = str.match(/local/) puts m[0] end ❯ ruby if-assignment-in-conditional.rb local 正式名称がわからず、検索に苦労したが、assignment in a conditional clause などと呼ぶらしい。 Python で同じ書き方をすると syntax error になる。 import re with open('/etc/hosts') as f: if m = re.sear…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.kyanny.me%2Fentry%2F2021%2F08%2F29%2F040610&quot; title=&quot;Python 3.8 以降で Ruby の if m = &amp;quot;foo&amp;quot;.match(/foo/) みたいに if の条件の結果を代入するには if m:= xxx とする - @kyanny&amp;#39;s blog&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>2021-08-29 04:06:10</published>
  <title>Python 3.8 以降で Ruby の if m = &quot;foo&quot;.match(/foo/) みたいに if の条件の結果を代入するには if m:= xxx とする</title>
  <type>rich</type>
  <url>https://blog.kyanny.me/entry/2021/08/29/040610</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
