1

I am using PyCharm as my IDE. Now when I write a script in python as shown below I can place Breakpoints throughout the code and can take any Debugging Actions i.e Step Into, Step Out, etc.

Why can't I Step Into any built-in function e.g as in my script below max()?

And when I go to implementation of built-in function, the function implementaion contains only pass. I searched Stackoverflow found this.

 a = [-5, -4, -3, -2, -1]

    
def max_element(values):
    """
    Finds the max element in an iterable.
    """
    result = -float('inf')
    for value in values:
        if value > result:
            result = value
    return result


max_element_from_builtin = max(a)
print(max_element_from_builtin)

max_element_from_custom = max_element(a)
print(max_element_from_custom)

So, how to see implementation and debug the built-in functions of Python in PyCharm?

2
  • 1
    Built-in functions can be C implemened. Depending on the debugger and the build settings you can not step into them. It shouldn't be nessesary to debug your code anyway. Commented Sep 20, 2020 at 15:06
  • @KlausD. Script is for clarifying my question. Commented Sep 20, 2020 at 15:19

0

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.