Nicolas 解决方案 Nicolas Fleury写道: 我想知道是否可以减少对语言的需求。对于示例,可以自动地将以=或+结尾的行视为不完整吗? 在以下情况下,Python应该做什么? a = 5 + someFunc(a) 好​​的,你想要它静静地加5和someFunc()的结果和 分配给a。如果我告诉你我实际上打算添加5 加上b,该怎么办?并分配给a,然后调用someFunc()并丢弃返回值。 你刚刚把一个很好的干净错误信息从编译器变成了一个 沉默且可能是致命的错误。 显式优于隐式,错误永远不会无声地传递 最近再次注意到另一个帖子。 -Peter Nicolas Fleury< ni ****** @ yahoo.com_remove_the_>写在 新闻:h4 ********************* @nnrp1.uunet.ca: 我想知道是否可以减少语言中对\\的需求。对于示例,以=或+结尾的行是否可以自动被视为不完整? 您很少需要\因为它是。任何带括号的表达式都可以在没有问题的情况下分开 。 - Duncan Booth du **** @ rcp.co.uk int month(char * p){return(124864 /(( p [0] + p [1] -p [2]& 0x1f)+ 1)%12)[" \\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\ 4"];} //谁说我的代码模糊不清? Nicolas Fleury写道: 我想知道是否可以减少对语言的需求。对于示例,以=或+结尾的行是否可以自动被视为不完整? 您是否知道(...) ? (" alpha" .... +" beta" .... +gamma .... ....) ''alphabetagamma '' Peter Hi,I was wondering if the need for \ could be reduce in the language. Forexample, could a line ending with = or + could be automaticly consideredincomplete?Regards,Nicolas 解决方案 Nicolas Fleury wrote: I was wondering if the need for \ could be reduce in the language. For example, could a line ending with = or + could be automaticly considered incomplete?What should Python do in the following case?a = 5 +someFunc(a)Okay, you want it to quietly add 5 and the result of someFunc() together andassign to "a". What if I told you that I actually had intended to add 5plus "b" and assign to a, then call someFunc() and discard the return value.You''ve just turned a nice clean error message from the compiler into asilent and possibly deadly bug."Explicit is better than implicit, and errors should never pass silently"as has been noted again recently in another thread.-PeterNicolas Fleury <ni******@yahoo.com_remove_the_> wrote innews:h4*********************@nnrp1.uunet.ca: I was wondering if the need for \ could be reduce in the language. For example, could a line ending with = or + could be automaticly considered incomplete?You very rarely need \ as it is. Any parenthesised expression may be splitacross lines without problems.--Duncan Booth du****@rcp.co.ukint month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3""\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?Nicolas Fleury wrote: I was wondering if the need for \ could be reduce in the language. For example, could a line ending with = or + could be automaticly considered incomplete?Did you know about (...)? ("alpha".... + "beta".... + "gamma"........ )''alphabetagamma''Peter 这篇关于减少反斜杠的需要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-03 07:34