本文介绍了为什么括号和&amp; func调用中的逗号不能被省略? (也许它可能是PEP?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好, 我期待PEP&没有找到一个删除括号的命题& 逗号来使Python函数调用语法像caml-或tcl一样:而是 of result = myfun(param1,myfun2(param5,param8),param3) 只能使用 result = myfun param1(myfun2 param5 param8)param3 它会减少代码行的长度并使它们更具可读性+ +没有 需要编写annoing charecters。 也许它会需要比我想象的更多的工作,例如处理 之类的东西,比如 result = myfun(param1,myfun2(param5,param8),param3 = 15,param4 = 200) to result = myfun param1(myfun2 param5 param8)param3 = 15 param4 = 200 #so 需要更多努力才能解码编译器 但无论如何我觉得它值得。 +它不会让以前的Python版本不兼容。 WBR,D。 解决方案 你好Dmitrey, 我看了PEPs&没有找到一个删除括号的命题& 逗号来使Python函数调用语法像caml-或tcl一样:而是 of result = myfun(param1,myfun2(param5,param8),param3) 只能使用 result = myfun param1(myfun2 param5 param8)param3 如果你有 结果= func1 func2 arg 是它 result = func1(func2,arg) 或 result = func1(func2(arg)) Miki< mi ** *******@gmail.com> http://pythonwise.blogspot。 com 我认为应该结果 result = func1(func2,arg) 如果你想要 result = func1(func2(arg)) 你应该使用 result = func1(func2 arg) 如果 .... = word1 word2 word3 ... 那么只有单词word1应该调用funcword1带参数 word2,word3等 如果你有 result = func1 func2 arg 是吧 result = func1(func2,arg) 或 result = func1(func2(arg) )) Miki< miki.teb ... @ gmail.com> http://pythonwise.blogspot.com dmitrey写道: 它会减少代码行的长度并使它们更具可读性。 +无需编写annoing charecters。 恕我直言,它的可读性较差。 我想我不是我自己的意见。 问候, Bj? - BOFH借口#34: (l)用户错误 Hi all,I looked to the PEPs & didn''t find a proposition to remove brackets &commas for to make Python func call syntax caml- or tcl- like: insteadofresult = myfun(param1, myfun2(param5, param8), param3)just make possible usingresult = myfun param1 (myfun2 param5 param8) param3 it would reduce length of code lines and make them more readable, + noneeds to write annoing charecters.Maybe it will require more work than I suppose, for example handlingof things likeresult = myfun(param1, myfun2(param5, param8), param3=15, param4=200)toresult = myfun param1 (myfun2 param5 param8) param3=15 param4=200 #soit needs some more efforts to decode by compiler but anyway I think it worth.+ it will not yield incompabilities with previous Python versions. WBR, D. 解决方案 Hello Dmitrey, I looked to the PEPs & didn''t find a proposition to remove brackets &commas for to make Python func call syntax caml- or tcl- like: insteadofresult = myfun(param1, myfun2(param5, param8), param3)just make possible usingresult = myfun param1 (myfun2 param5 param8) param3If you haveresult = func1 func2 argis itresult = func1(func2, arg)orresult = func1(func2(arg)) Miki <mi*********@gmail.com> http://pythonwise.blogspot.com I think it should resultresult = func1(func2, arg)if you wantresult = func1(func2(arg))you should useresult = func1 (func2 arg)if.... = word1 word2 word3 ...then only word "word1" should be call to func "word1" with parametersword2, word3 etc If you haveresult = func1 func2 argis itresult = func1(func2, arg)orresult = func1(func2(arg))Miki <miki.teb...@gmail.com>http://pythonwise.blogspot.com dmitrey wrote: it would reduce length of code lines and make them more readable,+ no needs to write annoing charecters.IMHO, it''s less readable. I suppose I''m not on my own with this opinion. Regards,Bj?rn --BOFH excuse #34: (l)user error 这篇关于为什么括号和&amp; func调用中的逗号不能被省略? (也许它可能是PEP?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-01 15:48