I hope you are doing great! In our previous post, we talked about Functions in Python. Let’s try to explore another piece of this puzzle. So, in this post, we will talk about Functions in C.

C functions have the least call overhead, making them orders of magnitude faster than Python functions. A general C function can have several properties:

  • It can be passed as an argument to other functions (but doing so is much more inconvenient than in Python). 
  • It cannot be defined inside another function
  • A C function has a statically assigned name that is not modifiable;
  • A C function can take arguments only by position.
  • And it does not support default values for parameters.

In the consideration of Function in Python and C, you should keep in mind that: All of the power and flexibility of Python functions comes at a cost: Python functions are several orders of magnitude slower than C functions—even functions that take no arguments.

At this point, we explored some basic points about a Function in Python & C, but this is a post series about Cython, so where it is in the game?

Cython supports both Python and C functions and allows them to call each other in a natural and straightforward way, all in the same source file. That’s what we are going to explore in our post. We will understand that how a Python function behaves inside Cython code?

That’s enough for this post. I hope you really enjoyed the post. Thanks for reading!

Dec. 29, 2021
Web Development

More from 

Web Development


View All