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?

Arpit-Gole
  • 365
  • 2
  • 6
  • 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. – Klaus D. Sep 20 '20 at 15:06
  • @KlausD. Script is for clarifying my question. – Arpit-Gole Sep 20 '20 at 15:19

0 Answers0