Nv7
Nv7

Reputation: 426

Find souce code for eval() function Python

I am trying to modify the source code for the eval() function, in my own file, so I need the source code.

I have tried writing eval with an error, but that just says error in . I tried using the inspect function, but that said "TypeError: is a built-in class ".

This is what I did for inspect:

import inspect
print(inspect.getsource(eval))

Can you tell me how to find it, or even just give me a link to github file?

Upvotes: 0

Views: 4130

Answers (1)

Alec
Alec

Reputation: 9536

Even though some python functions are written in python, most core functions are actually implemented in C.

Here is the source code for the eval() function.

Upvotes: 3

Related Questions