026第12章 A SHIP THAT FIRES BULLETS_續3_helper method

wenwen
·
·
IPFS
·
忘了當天PO文

💛20230126 晨讀感言:

💔瞭解重構(Refactor)和輔助方法(helper method)這兩個名詞所代表的意涵。

💔 一個輔助方法在一個類中工作,但並不是要通過一個實例來調用。在 Python 中,一個前導下划線表示一個輔助方法。

💔所調用的輔助方法(helper method),可以放在 你呼叫時所在程式碼 的 下方處,這和 當你呼叫 一般方法(method) 時,這些 一般方法 必須在 你呼叫時所在程式碼的 上方處 不同。

💛晨讀摘要:

💚236 In large projects, you’ll often refactor code you’ve written before adding more code. ==Refactoring simplifies the structure of the code you’ve already written, making it easier to build on==. In this section, we’ll break the run_game() method, which is getting lengthy, into two helper methods. ==A helper method does work inside a class but isn’t meant to be called through an instance. In a Python, a single leading underscore indicates a helper method==.

from:《python crash course》

CC BY-NC-ND 2.0

Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!

wenwen探索網路世界和進入區塊鏈的過程或許很平凡,但我就是想分享給大家,若能幫助到有需要幫助的人,那就更好了。 有幫到你的話,記得按下方拍手圖,不需花你任何金錢,免費註冊Liker ID,就可對我化讚為賞:https://button.like.co/willie5068
  • Author
  • More

033第12章 A SHIP THAT FIRES BULLETS_續10_pygame.sprite.Group class

032第12章 A SHIP THAT FIRES BULLETS_續9_pygame.Rect() class

031第12章 A SHIP THAT FIRES BULLETS_續8_super().init()