在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
当前回答
在Python中:
>>> x = 4
>>> y = 1000000
>>> x is 4
True
>>> y is 1000000
False
>>>
如果你不相信,就试试吧!
其他回答
C的多个名称空间:
typedef int i;
void foo()
{
struct i {i i;} i;
i: i.i = 3;
printf( "%i\n", i.i);
}
或与字符:
typedef char c;
void foo()
{
struct c {c c;} c;
c: c.c = 'c';
printf( "%c\n", c.c);
}
Perl:
可以编写一个完全由标点符号组成的程序。
这是怎么回事?!
c++最恼人的解析:
struct S
{
S() {} //default constructor
};
int main() {
S s(); // this is not a default construction, it declares a function named s that takes no arguments and returns S.
}
来自边远吗?
在PHP中:
for ($s="a";$s<="z";$s++) echo $s.' ';
这将是:
a b c d e .. .w x y z aa ab ac ad .. ay az ba bb bc ... by bz ca cb ... yz za zb ... zx zy zz