MicahWW / Python-Games

2 stars 0 forks source link

Standardizing "no arg no return" language #67

Open codyswanner opened 1 year ago

codyswanner commented 1 year ago

I want to standardize our language around functions that don't take arguments and don't make returns. I'd like to have something short and clear, and make them all consistent.

Some examples we have now, in the order they appear in TicTacToe.py:

"Does not take in anything or return anything" (resetGame) "Takes no inputs and makes no return" (terminalGame) "Takes no arguments and gives no return" (displayBoard) "Takes in nothing and returns nothing" (displayResult)

We also have one that does return something but "Takes no inputs" (gameSettingsPrompt), which highlights that whatever we choose, we need to be able to split it apart if needed. All the above examples satisfy this requirement, but that's something to keep in mind if we brainstorm more options.

My preferences

I kind of like "makes no return" for that part of the language. It's short, clear and technically more accurate than "returns nothing" because that implies something like return None or return 0. (The best kind of more accurate.)

I don't have a strong preference for the arguments part, I think of the above options I like "takes no arguments" but could definitely be convinced on something else.

MicahWW commented 1 year ago

Bringing in a quote from pull request #69 as once it gets merged it might be missed.

If changes are made, ensure the following methods are updated:

  • updateBoard
  • checkBoard
  • resetGame
  • updatePlayerIcons
  • advancedGameSettings
  • gameSettingsPrompt
  • terminalGame
  • displayBoard
  • displayResult
MicahWW commented 1 year ago

I want to think about this some more before making a comment.

MicahWW commented 1 year ago

You mentioned that:

I kind of like "makes no return" for that part of the language. It's short, clear and technically more accurate than "returns nothing" because that implies something like return None or return 0.

That is technically not true, every function/method must have a return, even if you don't include one as shown here.

With that and my idea of staying consistent between functions, I would like to do something like the below for a function that takes no inputs and returns nothing as it keeps to the same style as a function that does take inputs and returns.

"""Summary...
...

:param: NONE
:returns: NONE
"""