English


A Python file may contain many function definitions and even nested function definitions. A commonly accepted graphics for the flowchart diagrams however does not offer anything well suitable for the real life Python functions. So something new should be suggested.

One of the thoughts which came to my mind was the idea of a scope. The term scope comes up when, for example, accessing variables within functions is discussed. A scope plays a role of borders where a variable is available if it is created in a function. Certainly a function has very definitive points where it starts and where it ends. So the graphics may use a sort of a rectangle - a scope - within which the function body is drawn. Actually sometimes it is a problem for me when I look at a middle of an unfamiliar Python code and I do not really understand if it is a function, a class member or some other nesting level - I have to scroll up to understand it. With the idea of a scope for a function it is possible to explicitly show the borders of a function with a distinctive background color so it is obvious immediately what the context is.

A function scope has a header where the function name and arguments are provided. Below a dividing line the function body is drawn. I also decided to add a small badge at the upper left corner of the scope rounded rectangle.