Where can I inspect Python's math functions?

后端 未结 4 2269
旧巷少年郎
旧巷少年郎 2020-12-06 16:16

I would like to look at the way Python does computes square roots, so I tried to find the definition for math.sqrt(), but I can\'t find it anywhere. I have look

4条回答
  •  攒了一身酷
    2020-12-06 17:10

    Some modules are written in C and not in python so you wouldn't be able to find the .py files. For a list of these you can use:

    import sys print sys.builtin_module_names

    Since it's written in C you will have to find it in the source code. If you have the source already it's in the modules directory.

提交回复
热议问题