You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remember that we can define this program right at the Python command line and then run it as per <xrefref="python-hello-world-run"text="type-global"/>.
187
+
Remember that we can define this program right at the Python command line and then run it with <c>main()</c> Try it in <xrefref="python-hello-world"text="type-global"/>.
188
+
</p>
189
+
190
+
<p>
191
+
The command line interface of the program is shown in <xrefref="python-hello-world-run"text="type-global"/>.
Notice that we used the decorator <c>@staticmethod</c> to tell the Python interpreter that <c>main</c> is going to be a static method.
509
-
The impact of this is that we don’t have to, indeed we should not, use <c>self</c> as the first parameter of the main method! Using this definition we can call the main method in a Python session like <xrefref="python-static-method-run"text="type-global"/>.
513
+
The impact of this is that we don’t have to, indeed we should not, use <c>self</c> as the first parameter of the main method! Using this definition we can call the main method in a Python session with <c>Hello.main("")</c>. Try it in <xrefref="python-static-method"text="type-global"/>.
510
514
</p>
511
515
516
+
<p>
517
+
The command line interface of the program is shown in <xrefref="python-static-method-run"text="type-global"/>.
0 commit comments