0

I was looking at how the wrap decorator was implemented in functools.py and it used partial(), which I then wanted to see how that was implemented. It was imported from _functools so I looked for _functools.py but couldn't find it. I grepped the whole python directory, and then my entire C: drive but nothing came up. Where is this file located? (Win7 x64)

Jpaji Rajnish
  • 1,491
  • 4
  • 17
  • 35
  • 3
    It's implemented in C, not Python. – Colonel Thirty Two Mar 11 '15 at 15:55
  • 1
    https://hg.python.org/cpython/file/2545bfe0d273/Modules/_functoolsmodule.c – jonrsharpe Mar 11 '15 at 15:56
  • 1
    In these cases, I usually use `inspect.getsource(some_object)`. If it _has_ source (due to being implemented in python), `inspect` will give it to you, otherwise it'll fail. Alternatively, you could just look at the module's `__file__` attribute (which is present only if the module is implemented in python) – mgilson Mar 11 '15 at 15:58

0 Answers0