<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>methane</author_name>
  <author_url>https://blog.hatena.ne.jp/methane/</author_url>
  <blog_title>methaneのブログ</blog_title>
  <blog_url>https://methane.hatenablog.jp/</blog_url>
  <categories>
    <anon>python</anon>
  </categories>
  <description>リストを受け取ってループで処理する関数を実装するとき、引数のタイプヒントに list ではなく最小の要求として Iterable を書くことを好む人がいる。コードの実装が引数に対して必要としている最小要件(必要十分条件)を表すためだ。 def func(arg: Iterable[int]) -&gt; None: for a in arg: do_work(a) しかし、その関数でログかトレースにその引数の中身を追加したくなった場合にどうしたらいいだろうか？ OpenTelemetryのAttributeValue型はSequenceには対応しているがIterableには対応していない。 また、I…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmethane.hatenablog.jp%2Fentry%2F2025%2F08%2F14%2F153453&quot; title=&quot;タイプヒントには「実装の最小要件」ではなく「想定範囲」を表す型を書く - methaneのブログ&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>2025-08-14 15:34:53</published>
  <title>タイプヒントには「実装の最小要件」ではなく「想定範囲」を表す型を書く</title>
  <type>rich</type>
  <url>https://methane.hatenablog.jp/entry/2025/08/14/153453</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
