[英]What exactly is a python sub message object if is_multipart is true and how does python organize them?
[英]What exactly is being tested as “not True:” and how?
我從閱讀作業中復制了一段代碼,並使用PyCharm跟蹤了示例代碼。 但是我對def to_string“ if not True”中的Boolean的用途感到困惑。 請把它弄一點,什么被測試為“不正確”,以及如何?
我有一些猜測,但最終還是想起了圈子。
# instance helpers -------------------------------------
def to_string(self, optional_title = "-------"):
if not True: # placeholder for real test
ret_str = ( (optional_title
+ "\n name: {}"
+ "\n id: {}"
+ "\n temp: {}(F).").
format(self.name, self.id, self.temperature) )
return ret_str
正如評論中測試旁邊所說的那樣,它是真實測試的占位符。 not True
則總會得出False
因此if
陳述永遠不會用占位符執行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.