[Tutor] help
David
bouncingcats at gmail.com
Tue Sep 22 22:30:38 EDT 2020
On Wed, 23 Sep 2020 at 07:55, Shreya Reddy <shreyaaaaoo at gmail.com> wrote:
>
> How do I get an in-built function's source code/function body?
> i want to get the function body part of flip function of cv2 module.
I don't have the cv2 module installed here so I cannot give you
a definitive answer.
But I can demonstrate to you how to investigate further.
I will use the 're' module as an example of how to locate
the file that contains the code of the 're' module.
$ python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.__file__
'/usr/lib/python3.7/re.py'
>>>
The file you find for cv2 might be python code, or it might not.
You can investigate this by running another command as
follows (run it in your command shell eg bash, not in
your python shell).
$ file /usr/lib/python3.7/re.py
/usr/lib/python3.7/re.py: Python script, ASCII text executable
Let us know what you find.
More information about the Tutor
mailing list