<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>podhmo</author_name>
  <author_url>https://blog.hatena.ne.jp/podhmo/</author_url>
  <blog_title>podhmo's diary</blog_title>
  <blog_url>https://pod.hatenablog.com/</blog_url>
  <categories>
    <anon>python</anon>
    <anon>logging</anon>
    <anon>mypy</anon>
    <anon>typing</anon>
  </categories>
  <description>pythonでlogging.Loggerとlogging.LoggerAdapterを許す型を定義する方法のメモ。 別の言い方をするとunion typeとprotocolを使ったstructured subtypingの違いのメモ。 (:warning: おそらくまだProtocolをimportするにはtyping_extensionsが必要です) 例 例えば以下のような関数があるとする。これを利用したい。duck typing的にはl.info()の形で使えれば十分。 def use(l: logging.Logger) -&gt; None: l.info(&quot;hello&quot;) ここでちょっと…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpod.hatenablog.com%2Fentry%2F2019%2F09%2F23%2F174945&quot; title=&quot;pythonでlogging.Loggerとlogging.LoggerAdapterを許す型を定義する方法のメモ - podhmo&amp;#39;s diary&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>2019-09-23 17:49:45</published>
  <title>pythonでlogging.Loggerとlogging.LoggerAdapterを許す型を定義する方法のメモ</title>
  <type>rich</type>
  <url>https://pod.hatenablog.com/entry/2019/09/23/174945</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
