[問題] kwargs in Golang

看板Python作者 (用功點吧!)時間8年前 (2018/01/11 11:12), 編輯推噓0(003)
留言3則, 3人參與, 8年前最新討論串1/1
因為沒有 Golang 版,所以在這邊發問。 最近開始學習 Golang,才覺得 Python 寫起來真的很爽快。 想要問一下 python 的 kwargs 功能,在 Golang 怎麼達成? 例如我的function只要定義成以下: def my_func(v, **kwargs): 之後 call 的時候,我可以這樣做 my_func(1, k1=1, k2=2, k3=3) 或是 my_func(1, k1=1, k2=2, k3=3, k4=4) 這樣我的 function interface 都不用動,請問在 Golang 怎麼做到這樣呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 211.22.61.74 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1515640379.A.AC9.html

01/11 11:33, 8年前 , 1F
你無法這樣做
01/11 11:33, 1F

01/11 11:41, 8年前 , 2F
瞭解了
01/11 11:41, 2F

01/11 12:05, 8年前 , 3F
現階段在 Programming 版問或許比較好,畢竟是不同東西
01/11 12:05, 3F
文章代碼(AID): #1QLjOxh9 (Python)