December 2018
Beginner to intermediate
796 pages
19h 54m
English
Having a custom function in a snippet that you can quickly grab and paste into the code, and then use to debug, can be very useful. If you're fast, you can always code one on the fly. The important thing is to code it in a way that it won't leave stuff around when you eventually remove the calls and its definition. Therefore it's important to code it in a way that is completely self-contained. Another good reason for this requirement is that it will avoid potential name clashes with the rest of the code.
Let's see an example of such a function:
# custom.pydef debug(*msg, print_separator=True): print(*msg) if print_separator: print('-' * 40)debug('Data is ...')debug('Different', 'Strings', 'Are not a problem') ...Read now
Unlock full access