Revision history and IPFS entry, back to latest
wenwen
IPFS What is this

Content Hash

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

wenwen
·
·
忘了當天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