Re: [問題] 怎麼用 Python 寫出 switch 的功能?

看板Python作者 (貓橘毛發呆雕像)時間7年前 (2017/10/19 17:19), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串9/11 (看更多)
class-based https://repl.it/JZn4/12 但還是很醜........ 如果沒猜錯的話,外層應該會在 init() < 0 的時候再 release_process3() 。 這樣的行為跟 switch-case 的 fall-through 其實沒啥關係... (btw, golang 的 switch 是 fall-through by default) 比較有關的大概是 RAII (https://goo.gl/jZHYyw ),在 Python 基本上就是用 context manager 來實作。 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 203.77.72.241 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1508433543.A.15B.html
文章代碼(AID): #1PwDw75R (Python)
討論串 (同標題文章)
完整討論串 (本文為第 9 之 11 篇):
文章代碼(AID): #1PwDw75R (Python)