python - PyCharm: debugging line by line? -
i using pycharm (community version) python ide. want program debug in line-by-line fashion. don't want set every line break point... there way this?
as @cyber mentioned, debugging hotkeys let step through line line, step down function calls, etc., once you've hit breakpoint , stopped somewhere.
if want step through each line, set breakpoint somewhere @ beginning of code. if you're using main() function in code, e.g.:
def main(): .... if __name__ == '__main__': main() # breakpoint here, 'step inside' go next line
then set breakpoint @ call main()
. (if you're not, might want try approach.)
one other thing i'd point out pycharm's easy-to-overlook feature of conditional breakpoints. if right-click on breakpoint symbol in gutter area of editor, can type in condition, n > 10
; breakpoint triggers when line executed , condition met. when you're trying debug code issues within recursive function, say, can simplify things lot.
i know last part isn't asking for, codebase gets bigger, going through each line can time consuming. you'll want focus more on things unit testing , logging larger projects.
Comments
Post a Comment