[Python] 使用 functools.partial() 固定函式參數並返回新的 partial 物件
關於 partial 函式
在閱讀一些大神所寫的 Python 原始碼的過程中,想必偶爾會見到 functools.partial
的使用,而直觀上,這個函式的意義似乎並不是那麼好理解。那麼,partial()
函式的功用究竟是什麼呢?
在閱讀一些大神所寫的 Python 原始碼的過程中,想必偶爾會見到 functools.partial
的使用,而直觀上,這個函式的意義似乎並不是那麼好理解。那麼,partial()
函式的功用究竟是什麼呢?
今天我想要久違地使用 ChatGPT 幫我重新建構我以前寫的音樂播放器,但是因為私心想要使用開源免費的 PySide6 來取代當初使用的 PyQt5 模組,所以嘗試著在筆電上重新安裝了 PySide6 套件。
Read More »[已解決] pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPoolGiven an array arr
of positive integers sorted in a strictly increasing order, and an integer k
.
Return the kth
positive integer that is missing from this array.
前一陣子,我在研究如何使用 Transformer 強化學習 (Transformer Reinforcement Learning, TRL) 這一技術/套件時,我跑官方的腳本會出現一個關於 numpy 的錯誤。其錯誤訊息如下:
Read More »[已解決] module 'numpy' has no attribute 'item'Read More »[Linux] 使用 `pygmentize` 或 `highlight` 來顯示、印出帶有顏色的文件內容「我大部分的上班時間都用來找一些讓 Linux 終端機顯示得更漂亮的工具,
反正老闆看了也只會覺得我很厲害要有美觀的介面才能提高生產力!」 —— 愛貓工程師
For two strings s
and t
, we say "t
divides s
" if and only if s = t + ... + t
(i.e., t
is concatenated with itself one or more times).
Hydra是一個開源的 Python 框架,它被設計用來簡化研發佈署的流程(尤其是在複雜的應用上)。Hydra 能夠在佈署時動態地建立階層式的設定檔案、也透過命令列(command line)來繼承(複寫)設定檔。
Read More »Hydra 環境配置管理套件筆記Given an undirected tree consisting of n
vertices numbered from 0
to n-1
, which has some apples in their vertices. You spend 1 second to walk over one edge of the tree. Return the minimum time in seconds you have to spend to collect all apples in the tree, starting at vertex 0 and coming back to this vertex.
Given the roots of two binary trees p
and q
, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical, and the nodes have the same value.
Read More »LeetCode: 100-Same Tree 解題紀錄