在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
当前回答
Python 2. x
>>>True = False
>>>True
False
你真的可以让一个人变得疯狂。
其他回答
另一个C-ism。
int i= 0;
while( i != 12 ) {
/* Some comment
i += 1;
/* Another comment */
}
为什么不行?棉绒会告诉你。然而,C编译器通常会轻松地忽略这一点。我也是。
当我发现问题出在哪里的时候,那真是太棒了。
2000年Perl Journal's obfusated Perl Contest的最佳参赛作品:
#:: ::-| ::-| .-. :||-:: 0-| .-| ::||-| .:|-. :||
open(Q,$0);while(<Q>){if(/^#(.*)$/){for(split('-',$1)){$q=0;for(split){s/\|
/:.:/xg;s/:/../g;$Q=$_?length:$_;$q+=$q?$Q:$Q*20;}print chr($q);}}}print"\n";
#.: ::||-| .||-| :|||-| ::||-| ||-:: :|||-| .:|
代码由作者在http://mysite.verizon.net/les.peters/id2.html详细解释
在Javascript中,我认为以下是等价的:
a['title'] = "Syntactic sugar is good for yr teeth.";
a.title = "Syntactic sugar is good for yr teeth.";
BrainFuck语言。真的是这样!
VBScript的With block:
With xml.appendChild(xml.createElement("category"))
.setAttribute("id",id)
.setAttribute("keywords",keywords)
With .appendChild(xml.createElement("item"))
.setAttribute("count",count)
.setAttribute("tip",tip)
.appendChild(xml.createTextNode(text))
End With
End With