2

How can we write a massive - fast module for python? I mean how they write a module like numpy that executes heavy pieces of code in python (which is very slow) so fast? Are they using the C/Python API for that matter? Or it's something else?

6
  • 1
    Checkout How Fast Numpy Really is and Why? Commented May 10, 2020 at 23:29
  • 3
    "executes heavy pieces of code in python (which is very slow) so fast?" - because it executes compiled C code, not Python. "Are they using the C/Python API for that matter?" - yes, they are using the C Python API for sure. Commented May 10, 2020 at 23:41
  • @MarcoBonelli is correct - it's ironic we have modules for Python being written in C. Commented May 11, 2020 at 0:37
  • 1
    @Johnny not really. Any language has similar features that permit embedding or calling native code. Performance optimization is a thing. Also, Python itself is written in C. Commented May 11, 2020 at 0:38
  • @MarcoBonelli of course, it's just interesting that most packages for a language are made in a different language. Like writing an English book in French. Commented May 11, 2020 at 0:41

1 Answer 1

2

Extension can be written in C/C++ with connectors to other python objects and functions.

The official python documentation has a C/C++ API reference

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.