<?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>memo</anon>
    <anon>functools</anon>
  </categories>
  <description>時折、functools.partialで作られた値の元の値(関数)を辿りたくなることがある。そのようなことをしたくなった場合のメモ。 単純に辿りたい場合 単純に辿りたい場合は.funcを見れば良い。ついでにクラスである場合もサポートしてあげると親切。 def find_original(fn): if isinstance(fn, partial): fn = fn.func if inspect.isclass(fn): fn = fn.__init__ return fn functools.partialの元を辿ることができる。 def f(x, y, *, z): return (x…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpod.hatenablog.com%2Fentry%2F2018%2F08%2F13%2F223416&quot; title=&quot;functools.partialの元を辿る - 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>2018-08-13 22:47:09</published>
  <title>functools.partialの元を辿る</title>
  <type>rich</type>
  <url>https://pod.hatenablog.com/entry/2018/08/13/223416</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
