Note that there are some explanatory texts on larger screens.

plurals
  1. POPython: Use spaces in a function name?
    primarykey
    data
    text
    <p>I am writing a python scripts to call a function.</p> <p>Normally function are called:</p> <pre><code>def myCall(): print "Hello World" </code></pre> <p>But I would like to name/use the function as:</p> <pre><code>def my Call(): print "I did it!" </code></pre> <p>I knew the world will start thinking why the programmer name the function this ways. Just replace the "space" with "under score" or something else! Hm... but that's not how I want the script to work.</p> <p>Any suggestion to call the function with "space"?</p> <p><strong>-------------------------------------------ADD-ON----------------------------------------</strong></p> <p>Ok guys! I am going to explain how my script works. Specifically why I use space in a function name. There are a lot of curosity in this page, thus I place this add-on to explain why I did it.</p> <p>I hope this will help everyone understand why I did this :) </p> <p>Cheer with Respect!</p> <p>E.g.</p> <pre><code>=============== Welcome Menu =============== 1. Option 1 2. Option 2 3. Option 3 4. Option 4 </code></pre> <p>I have a user main menu and the main will constantly update every to check before it display the options above</p> <pre><code>array = ["Option 1", "Option 2", "Option 3", "Option 4"] </code></pre> <p>The checking are done because when some variable (declare in front the script) are missing, the specific option confirm would not work.</p> <p>E.g.</p> <pre><code>for x in range(a) print "Menu Option </code></pre> <p>I place my menu in a loop (Meaning print once only), The counting of the number in the menu are separated from the string option are auto increment each when there is 1 more element in the array to print the counting. The Option variable are place in the array.</p> <p>The user will select what he/she want in the options. Let said the user select "Option 1", it will goes to the array (array = ["Option 1", "Option 2", "Option 3", "Option 4"]) to check which position. </p> <p><strong>Remember the array are not FIXED!!! It change depend on the variable declare in the front of the script.</strong></p> <p>All vaildation are done to prevent errors, crash, etc!</p> <p>Finally, I have write a function (with space)</p> <p>And in the loop, it will call the function (with space). The function will need to link back to the array to change.</p> <p><strong>-------------------------------------------ADD-ON----------------------------------------</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload